Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / to connect wxtextctrl from main dialog to parent dialog

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. to connect wxtextctrl from main dialog to parent dialog
#2739
Posted by: 2003-10-15 06:40:30
If i connect the wxtextctrl with text into the same dialog is very simple:

void MyMainDialog::OnWrite(wxCommandEvent& WXUNUSED(event))
{
//into main dialog:

float x,y;
wxString tot;
x = atof(name_text->GetValue().c_str());
y = atof(level_text->GetValue().c_str());
tot.Printf("%8.2f",x+y);
this->MyMainDialog::tot_text->Clear();
this->MyMainDialog::tot_text->WriteText(tot);

//into parent dialog:
this->MyParentDialog::tot_text->WriteText(tot);
}

but if i try to connect a wxtextctrl and redirect the input to parent dialog,
i receive an error!!!

Giuseppe.
Message2. Re: to connect wxtextctrl from main dialog to parent dialog
#2746
Posted by: 2003-10-16 02:17:52
Hi!
Would you mind giving us some more info on what you plan to do?
Maybe some more source code or a little discription of what you did so far and what errors you get. "i receive an error" is not that detailed...

upcase
Message3. Re: to connect wxtextctrl from main dialog to parent dialog
#2748
Posted by: 2003-10-16 03:19:12
My application is fairly trivial. The application is composed by two dialogs;
the first dialog have a wxbutton and a wxtextctrl. The other dialog contains
an other wxtextctrl. If i put  a string into the first wxtextctrl, i need that, clicking the button, the same string to be into the other wxtextctrl, been into the second dialog :

void MainDialog::WriteSecondText(wxCommandEvent&  WXUNUSED(event))
{
    this->SecondDialog::textCtrl2->WriteText(some_string);
}

The output:
349 C:WINDOWSDesktopmain.cpp
type `SecondDialog' is not a base type for type `MainDialog'

Giuseppe.
Message4. Re: to connect wxtextctrl from main dialog to parent dialog
#2749
Posted by: 2003-10-16 05:47:17
Sorry for my bad english, i would say child dialog, not parent...
Giuseppe.
Message5. Re: to connect wxtextctrl from main dialog to parent dialog
#2750
Posted by: 2003-10-17 03:11:08

    MyMainDialog* frame = (MyMainDialog*) GetParent();

   frame->tot_text->WriteText(tot);

My english is bad ,too :>
Message6. Re: to connect wxtextctrl from main dialog to parent dialog
#2751
Posted by: 2003-10-17 06:13:21
Thanx, it works perfectly!
Giuseppe.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2023-1-27  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0