Click here to Skip to main content
15,921,793 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalshow/hide a pane in static splitter window Pin
gailya23-Jan-04 21:57
gailya23-Jan-04 21:57 
GeneralRe: show/hide a pane in static splitter window Pin
Antti Keskinen23-Jan-04 23:00
Antti Keskinen23-Jan-04 23:00 
GeneralCScrollview data plotting & grabbing the plotted data Pin
JHAKAS23-Jan-04 19:41
JHAKAS23-Jan-04 19:41 
GeneralDisplaying text in MDI Pin
hurr1can323-Jan-04 19:32
hurr1can323-Jan-04 19:32 
GeneralRe: Displaying text in MDI Pin
Antti Keskinen23-Jan-04 23:04
Antti Keskinen23-Jan-04 23:04 
GeneralHelp the Newbie(plz) Pin
MrNiceBerG23-Jan-04 18:46
MrNiceBerG23-Jan-04 18:46 
GeneralRe: Help the Newbie(plz) Pin
monrobot1323-Jan-04 20:33
monrobot1323-Jan-04 20:33 
GeneralRe: Help the Newbie(plz) Pin
Antti Keskinen23-Jan-04 23:24
Antti Keskinen23-Jan-04 23:24 
I am not really and MFC pro either, but perhaps I can grant more insight of what is happening to you.

If you are creating a dialog-based solution, you can use the Dialog Data Exchange to bind a CString object into the contents of the edit box. Then, calling UpdateData(TRUE) would copy the contents of the edit box into the CString variable. Calling UpdateData(FALSE) would update the controls from the variables.

After this, you can use the previously posted method to update the static control's text, issuing the name of CString object as a parameter to the SetWindowText method.

Here is a hands-on example on how it might be implemented:
// In your dialog's header file, create two member variables
CString m_csEditBoxText;
CStatic m_StaticControl;<DIV>

 .... <DIV>

// In the implementation file of the dialog
void CMyDialog::DoDataExchange( CDataExchange* pDX )
{
    // Bind the CString into the value of the edit box
    // and the CStatic into the static control
    DDX_Text( pDX, IDC_EDIT_CONTROL_ID, m_csEditBoxText );
    DDX_Control( pDX, IDC_STATIC_CONTROL_ID, m_StaticControl );
}<DIV>

 .... <DIV>

// In the button click message handler
void CMyDialog::OnClickButtonX( someParams )
{
    // First, update the member variables from the controls
    UpdateData(TRUE);<DIV>

    // Copy the CString contents into the CStatic member
    m_StaticControl->SetWindowText( m_csEditBoxText );<DIV>

    // Do a reverse-update, updating the dialog controls from the variables
    UpdateData(FALSE);<DIV>
}
This implementation should work, assuming you have given an identifier to both the edit box and the static control (all static controls default to having IDC_STATIC as their identifier). Then put these identifiers into the dialog data exchange routine. I have not tested it, but if it does not work, then use the implementation given in the previous post to update the static control's caption, removing the lowest two code lines from the button click handler.

Hope this will help you out

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: Help the Newbie(plz) Pin
MrNiceBerG24-Jan-04 5:19
MrNiceBerG24-Jan-04 5:19 
GeneralRe: Help the Newbie(plz) Pin
MrNiceBerG27-Jan-04 18:55
MrNiceBerG27-Jan-04 18:55 
GeneralDetachable tab control... Pin
Neha23-Jan-04 18:14
Neha23-Jan-04 18:14 
GeneralRe: Detachable tab control... Pin
Antti Keskinen23-Jan-04 22:43
Antti Keskinen23-Jan-04 22:43 
GeneralRe: Detachable tab control... Pin
Marcello25-Jan-04 8:15
Marcello25-Jan-04 8:15 
GeneralProblem in SearchPath Pin
SiddharthAtw23-Jan-04 17:46
SiddharthAtw23-Jan-04 17:46 
GeneralRe: Problem in SearchPath Pin
Mukkie25-Jan-04 7:56
Mukkie25-Jan-04 7:56 
GeneralRe: Problem in SearchPath Pin
SiddharthAtw26-Jan-04 17:24
SiddharthAtw26-Jan-04 17:24 
GeneralRe: Problem in SearchPath Pin
Mukkie27-Jan-04 7:35
Mukkie27-Jan-04 7:35 
GeneralRe: Problem in SearchPath Pin
SiddharthAtw28-Jan-04 21:42
SiddharthAtw28-Jan-04 21:42 
GeneralRe: Problem in SearchPath Pin
Mukkie29-Jan-04 5:50
Mukkie29-Jan-04 5:50 
GeneralRe: Problem in SearchPath Pin
SiddharthAtw29-Jan-04 22:14
SiddharthAtw29-Jan-04 22:14 
QuestionHave an idea, what do you think? Pin
youngjedi23-Jan-04 14:11
youngjedi23-Jan-04 14:11 
AnswerRe: Have an idea, what do you think? Pin
l a u r e n23-Jan-04 14:27
l a u r e n23-Jan-04 14:27 
GeneralAccess - changing database password from an EXE Pin
Kayembi23-Jan-04 9:07
Kayembi23-Jan-04 9:07 
GeneralRe: Access - changing database password from an EXE Pin
David Crow23-Jan-04 9:44
David Crow23-Jan-04 9:44 
GeneralCListView Custom Drawing: drop target icon Pin
bitpusher23-Jan-04 7:49
bitpusher23-Jan-04 7:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.