Show text after press a button
-
hi, I have an aplication whose view is based in TabControl. It has three tab and one of them have a Edit control. I'd like show text in this edit control when I press a button. I thought do a global variable that keep a valor, for example 1, and in the method, to do a control that show text only if the variable have valor 1. But my problem is after press button, don't happen something. I think that I must to update the view with the method onUpdate or something like that.. but I dont know how. What do you think? This is my aplication: http://i54.tinypic.com/1e9qtx.png This is code : http://www.megaupload.com/?d=1QT43LOQ\[^\]
-
hi, I have an aplication whose view is based in TabControl. It has three tab and one of them have a Edit control. I'd like show text in this edit control when I press a button. I thought do a global variable that keep a valor, for example 1, and in the method, to do a control that show text only if the variable have valor 1. But my problem is after press button, don't happen something. I think that I must to update the view with the method onUpdate or something like that.. but I dont know how. What do you think? This is my aplication: http://i54.tinypic.com/1e9qtx.png This is code : http://www.megaupload.com/?d=1QT43LOQ\[^\]
Global variables are usually not a good answer to anything. What you should do is post a message to the view and tell it to update the control whenever you need a value displayed or updated (use
SendMessage()
orPostMessage()
). You should not access the control directly from any window that does not own the control. In the future, try and post applicable code in your question. -
Global variables are usually not a good answer to anything. What you should do is post a message to the view and tell it to update the control whenever you need a value displayed or updated (use
SendMessage()
orPostMessage()
). You should not access the control directly from any window that does not own the control. In the future, try and post applicable code in your question.Ok, but I dont know how to update the control so that when I press the button show a message
-
Ok, but I dont know how to update the control so that when I press the button show a message
Well, there's a number of steps: 1. To get notification of a button press, make sure the button control owner is catching the notification message. 2. To alert the other control's owner of the button press, the message handler of the button press should SendMessage() or PostMessage() to the edit control owner window requesting he make the change. The owner window needs a message defined and appropriate message handler. 3. Within the owner of the edit control, the message handler for changes to the edit control should take the parameters passed to it, then set the window text. Which step do you not understand? As you can see, this is a somewhat complex process if you don't know how messaging works. You need to do a bit of research.
-
Well, there's a number of steps: 1. To get notification of a button press, make sure the button control owner is catching the notification message. 2. To alert the other control's owner of the button press, the message handler of the button press should SendMessage() or PostMessage() to the edit control owner window requesting he make the change. The owner window needs a message defined and appropriate message handler. 3. Within the owner of the edit control, the message handler for changes to the edit control should take the parameters passed to it, then set the window text. Which step do you not understand? As you can see, this is a somewhat complex process if you don't know how messaging works. You need to do a bit of research.
I don't have idea about messaging works, can you give me information? any page or something like that?
-
I don't have idea about messaging works, can you give me information? any page or something like that?
Look up Windows message handling... here's a few articles to get you started: Windows Message Handling - Part 1[^] Windows Message Handling - Part 2[^] Windows Message Handling - Part 3[^] Windows Message Handling - Part 4[^] http://msdn.microsoft.com/en-us/library/0x0cx6b1.aspx[^]