Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Updating Fields On A Dialog Box


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 WizzardUK   Members   -  Reputation: 122

Like
Likes
Like

Posted 15 July 2001 - 11:48 PM

Hey ppl, Can anyone help? I''m not a newbie (I have been using C++ at Uni for some time) but I don''t know much more than the basics. I am trying to get into Visual C++ (using MFC''s). Does anyone know how to update a text field on a dialog box with a char* field. I know I can use the SetDlgItemText() function to update fields in a window, but this doesn''t seem to work (or I can''t get it to work) with a dialog box. It will compile fine, but the field is left blank. If anyone can help, I would appreciate it greatly. Cheers Wizzard

Sponsor:

#2 Erebus   Members   -  Reputation: 122

Like
Likes
Like

Posted 16 July 2001 - 02:47 AM

First, you must attach a member variable to the edit box. To do this go into Class Wizard, select the Member Variables tab, select the ID of the edit box, and click Add Variable. Enter a name, select the type, etc.

Now, if you want the variable to have an initial value that is displayed when the dialog box is created go to the dialog classes constructor. Find your variable and enter your initial value.

OK, so you now have a variable and it has a value. I''m not sure if this value will be displayed right away or not. If not what you need to do is add the line UpdateData(FALSE); to the dialog''s OnInitDialog() function.

That ought to do it. Whenever you want to change the text in the program change the variable''s value and call UpdateData(FALSE); If you want to set the value of the variable to be the text in the edit box call UpdatData(TRUE); Whenever either changes you must call UpdateData() to keep them synchronized. Hope that answers your question.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS