![]() |
|
#1
|
|||
|
|||
changing caption of static text controlIs it possible to change caption of static text control in Visual C++ .Net in runtime. For example if user click on button caption on some static text control is changed. I declared CStatic variable named m_Text but dont know what to do next. Static text field has ID: IDC_TEXT
Code:
Thanks for help! |
|||
|
#2
|
||||
|
||||
|
Quote:
You can go 2 ways about this. 1. Do what you did, and than add this line in the data exchange section of your dialog: CPP / C++ / C Code:
Now your dialog is ready to exchange data with your control. Than, in your button's OnClick event: CPP / C++ / C Code:
However, IDC_TEXT might be defined as -1. In this case, define it in Resource.h with a different value - don't cae what that is, just something you didn't use for another control (>0, howerver). 2.(Recommended) Declare a member variable of your dialog as a pointer to CStatic: CPP / C++ / C Code:
Then, in your OnInitDialog, attach it to your dialog: CPP / C++ / C Code:
Change it's caption: CPP / C++ / C Code:
Mental Note: I should write a small tutor about data exchange and populating text controls sometime, since many people don't find it obvious the way that VC treats this controls. As a side note, I completely understand this, since I found it too confusing, and I think MS didn't find the best and most user-friendly way to handle the implementation of this controls. Hope this is what you were looking for. Best regards, Luci __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CD Burner Help - Power Calibration Error.... | JonBoy420 | Computer Hardware Forum | 111 | 19-Feb-2009 04:54 |
| How to add progress text to an MFC progress control? | m_dale | MS Visual C++ / MFC Forum | 3 | 07-Jan-2005 03:25 |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 11:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 12:28 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The