|
PowerBASIC Forums
![]() PowerBASIC for Windows
![]() tab from button to textbox??, text erased
|
| next newest topic | next oldest topic |
| Author | Topic: tab from button to textbox??, text erased |
|
Robert Alvarez Member |
I have on a dialog box two textboxes with text in it and two buttons. Focus is set to the button. When I tab to go from the How can you prevent the text in textbox from being erased ------------------ IP: Logged |
|
Clay Clear Member |
Sounds to me like you're manipulating the textbox text under the WM_COMMAND window message. That is a normal thing to do, but you should be aware that textbox's also send WM_COMMAND messages to their parent dialog when they receive or lose the focus. So what you need to do under the WM_COMMAND processor for the textbox is to also test the value of HI(WORD, wparam) (if you're using DDT, you can use the DDT CBCTLMSG statement). You will have to look in the PB Help file to see what values are passed in CBCTLMSG for textboxes when a textbox gets/loses the focus. Then you will need to modify your code so it checks for those values and does whatever it needs to instead of its default behavior for the WM_COMMAND message. ------------------ IP: Logged |
|
Robert Alvarez Member |
Thanks for the reply Clay. I do not manipulate text boxes using WM_COMMAND...use DDT CBCTLMSG... In the sample lines of text below I also notice that tabing from the two inside textboxes
CONTROL ADD TEXTBOX, hDlg2, %CAT1 , CATA ,90,30, 25, 12, %ES_READONLY This are just some of the button used. CONTROL ADD BUTTON, hDlg2, %BU1, "&1 ADD", 5, 305, 40, 14, CALL Addr_Add When I want to change a textbox field, I kill view textboxes and add textboxes like these, CONTROL ADD TEXTBOX, hDlg2, %CAT1, CATA ,90,30, 25, 12, 0 ------------------ IP: Logged |
|
Chris Boss Member |
Robert, Are you testing the CBCTLMSG value in the callback functions If you don't you will have problems, since more than one Here is how the code should look for a button or textbox:
You must test the CBCTLMSG value to make sure it is the correct These controls also will get events when the focus is changed The callback functions in PB are responding to the events that ------------------ IP: Logged |
|
Robert Alvarez Member |
Thank you for the reply Chris Do not quite understand how to use CBCTLMSG. (looking at the help it is used different) Since I am just tabing past the buttons and not clicking them, here I do understand Coming from Dos to window programming is a task for me. I only have two
....... CONTROL ADD BUTTON, hDlg2, %BU1, "&1 ADD", 5, 305, 40, 14, CALL Addr_Add ------------------ IP: Logged |
|
Chris Boss Member |
Robert, First thing I noticed you did wrong:
When processing events in a control callback, you must always For example, all notification messages (events through WM_COMMAND) You use a notification messages for Edit control (%EN_CHANGE) The first characters (up to the _ character) are considered The button control messages all start with %BM_ (B for Button, M for Message). The edit control messages start with %EM_ (E for edit, M for message) The same goes for other controls. Do not mix messages with other controls they aren't for ! ------------------ IP: Logged |
|
Robert Alvarez Member |
Found the problem, after fixing the code as you suggested it still had the same problem. Fix was making the textbox larger to fit the longer string size. When I tabed into that textbox Well I'll add this member help topic to my library in case I later I do encounter a problem where Thanks Chris & Clay for your help ------------------ IP: Logged |
All times are EasternTime (US) | next newest topic | next oldest topic |
![]() |
|
Copyright © 1999-2007 PowerBASIC, Inc. All Rights Reserved.