IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MFC Discussion :

[MFC] problème de récupération des edit en float


Sujet :

MFC

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    21
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 21
    Points : 10
    Points
    10
    Par défaut [MFC] problème de récupération des edit en float
    Boujour, dans l'une de mes boite de dialogue j'ai des edit en float, je met des chiffre dedant puis j'enregistre le fichier, et quand je veux ouvrir ce fichier, les edit en float reste a l'état initiale que je lui ai fixer, c'est à dire 0, donc ne reprend pas les chiffre que j'ai entré puis enregistrer alors que les edit en CString sont pris correctement.
    avez vous une solution a m'indiquer enfin si vous comprenez ce que je veux dire.

  2. #2
    Rédacteur
    Avatar de nico-pyright(c)
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    6 414
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 6 414
    Points : 16 075
    Points
    16 075
    Par défaut
    salut,

    tu enregistres comment ? tu lis comment ? tu affectes tes variables comment ? tu fais la mise à jour des controles comment ?

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    21
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 21
    Points : 10
    Points
    10
    Par défaut
    Dans CSampleView.cpp :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    void CSampleView::OnInitialUpdate()
    {
    	CFormView::OnInitialUpdate();
    	GetParentFrame()->RecalcLayout();
    	ResizeParentToFit();
    	TRACE("Mainframe:%X view:%X",AfxGetMainWnd()->GetSafeHwnd(),this->GetSafeHwnd());
    	m_Prix1=m_Prix2=m_Prix3=m_Prix4=m_Prix5=m_Prix6=m_Prix7=m_Total=0;
    	UpdateData(FALSE);
    	m_Raz.EnableWindow(FALSE);
    }
    void CSampleView::Serialize(CArchive& ar)
    {
        if (ar.IsStoring())
        {        
    ar<<m_Nomc<<m_Prenom<<m_Adresse<<m_Adresse2<<m_CP<<m_Ville<<m_Telf<<m_Telp<<m_Rem;
    ...
    ar<<m_Prix1<<m_Prix2<<m_Prix3<<m_Prix4<<m_Prix5<<m_Prix6<<m_Prix7<<m_Total;
        }
        else
        {
    ar>>m_Nomc>>m_Prenom>>m_Adresse>>m_Adresse2>>m_CP>>m_Ville>>m_Telf>>m_Telp>>m_Rem;
    ...
    ar>>m_Prix1>>m_Prix2>>m_Prix3>>m_Prix4>>m_Prix5>>m_Prix6>>m_Prix7>>m_Total;
        }
    }
    void CSampleView::OnButtonFact() 
    {
    	// TODO: Add your control notification handler code here
    	Dialog Dlg;
    	Dlg.m_Prix1=m_Prix1;
    	Dlg.m_Prix2=m_Prix2;
    	Dlg.m_Prix3=m_Prix3;
    	Dlg.m_Prix4=m_Prix4;
    	Dlg.m_Prix5=m_Prix5;
    	Dlg.m_Prix6=m_Prix6;
    	Dlg.m_Prix7=m_Prix7;
    	Dlg.m_Total=m_Total;
    	if(Dlg.DoModal()==IDOK)
    	{
    #ifdef _DEBUG
    		afxDump << "Prix1" << Dlg.m_Prix1 <<"\n";
    		afxDump << "Prix2" << Dlg.m_Prix2 <<"\n";
    		afxDump << "Prix3" << Dlg.m_Prix3 <<"\n";
    		afxDump << "Prix4" << Dlg.m_Prix4 <<"\n";
    		afxDump << "Prix5" << Dlg.m_Prix5 <<"\n";
    		afxDump << "Prix6" << Dlg.m_Prix6 <<"\n";
    		afxDump << "Prix7" << Dlg.m_Prix7 <<"\n";
    		afxDump << "Total" << Dlg.m_Total <<"\n";
    #endif
    	m_Prix1=Dlg.m_Prix1;
    	m_Prix2=Dlg.m_Prix2;
    	m_Prix3=Dlg.m_Prix3;
    	m_Prix4=Dlg.m_Prix4;
    	m_Prix5=Dlg.m_Prix5;
    	m_Prix6=Dlg.m_Prix6;
    	m_Prix7=Dlg.m_Prix7;
    	m_Total=Dlg.m_Total;
    	}
    }
    Dans SampleDoc.cpp :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    void CSampleDoc::Serialize(CArchive& ar)
    {
    	if (ar.IsStoring())
    	{
    		// TODO: add storing code here
    	}
    	else
    	{
    		// TODO: add loading code here
    	}
    	POSITION pos = GetFirstViewPosition();   
        CSalondeToilettageView* pView = static_cast<CSalondeToilettageView *>(GetNextView(pos));
        pView->Serialize(ar);
    }
    Dans Fact.cpp :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    BOOL CFact::OnInitDialog() 
    {
    	CDialog::OnInitDialog();
    	// TODO: Add extra initialization here
    	return TRUE;  // return TRUE unless you set the focus to a control
    	              // EXCEPTION: OCX Property Pages should return FALSE
    }
    void CFact::OnOK() 
    {
    	// TODO: Add extra validation here
    	UpdateData(TRUE);
    	CDialog::OnOK();
    }

  4. #4
    Membre à l'essai
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    21
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 21
    Points : 10
    Points
    10
    Par défaut
    J'ai trouvé se qui clochait fallait enlever
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    m_Prix1=m_Prix2=m_Prix3=m_Prix4=m_Prix5=m_Prix6=m_Prix7=m_Total=0;
    dans SampleView.cpp

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 31
    Dernier message: 27/07/2006, 13h51
  2. Réponses: 22
    Dernier message: 05/07/2006, 15h21
  3. [SQL] Problème de récupération des valeurs d'une liste multiple en php
    Par BOLARD dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 01/05/2006, 00h29
  4. Réponses: 2
    Dernier message: 31/03/2006, 09h23
  5. Réponses: 8
    Dernier message: 12/05/2005, 08h16

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo