martin
16-06-2009, 12:15
Hello Thinbasic Freaks :lol:
What's wrong with the following script? I get an error about CBMSG (not defined or misspelled keyword). CBMSG is also used in the Thinbasic textbox-example and works correctly with that script. So what am I doing wrong?
'Textbox Callback test
uses "ui"
begin const
%textbox1=1
end const
dim WindowMain AS DWORD
function TBMAIN()
DIALOG New 0, "Main Window",-1,-1, 110, 50, %WS_CLIPCHILDREN or %WS_OVERLAPPEDWINDOW, 0 To WindowMain
CONTROL ADD TEXTBOX, WindowMain,%textbox1, "", 5,25,100,10,,,textbox1proc
'---Show dialog
dim dlgCounter as long
Dialog Show Modeless WindowMain Call WindowMainProc
Do
Dialog DoEvents 0 To dlgCounter
Loop While dlgCounter
end function
callback function textbox1proc() as long
select case cbmsg
case %WM_COMMAND
select case CBCTLMSG
case %EN_SETFOCUS
case %EN_KILLFOCUS
case %EN_CHANGE
case %EN_UPDATE
CONTROL GET TEXT WindowMain, %textbox1 TO Txt
msgbox 0,"You typed: " & Txt
case %WM_NOTIFY
end select
end select
end function
CALLBACK FUNCTION WindowMainProc() AS LONG 'Callback for dialog
SELECT CASE CBMSG 'Test for messages
CASE %WM_INITDIALOG
CASE %WM_SIZING
CASE %WM_COMMAND
case %WM_NOTIFY
CASE %WM_CLOSE
END SELECT
END FUNCTION
Best regards,
Martin
What's wrong with the following script? I get an error about CBMSG (not defined or misspelled keyword). CBMSG is also used in the Thinbasic textbox-example and works correctly with that script. So what am I doing wrong?
'Textbox Callback test
uses "ui"
begin const
%textbox1=1
end const
dim WindowMain AS DWORD
function TBMAIN()
DIALOG New 0, "Main Window",-1,-1, 110, 50, %WS_CLIPCHILDREN or %WS_OVERLAPPEDWINDOW, 0 To WindowMain
CONTROL ADD TEXTBOX, WindowMain,%textbox1, "", 5,25,100,10,,,textbox1proc
'---Show dialog
dim dlgCounter as long
Dialog Show Modeless WindowMain Call WindowMainProc
Do
Dialog DoEvents 0 To dlgCounter
Loop While dlgCounter
end function
callback function textbox1proc() as long
select case cbmsg
case %WM_COMMAND
select case CBCTLMSG
case %EN_SETFOCUS
case %EN_KILLFOCUS
case %EN_CHANGE
case %EN_UPDATE
CONTROL GET TEXT WindowMain, %textbox1 TO Txt
msgbox 0,"You typed: " & Txt
case %WM_NOTIFY
end select
end select
end function
CALLBACK FUNCTION WindowMainProc() AS LONG 'Callback for dialog
SELECT CASE CBMSG 'Test for messages
CASE %WM_INITDIALOG
CASE %WM_SIZING
CASE %WM_COMMAND
case %WM_NOTIFY
CASE %WM_CLOSE
END SELECT
END FUNCTION
Best regards,
Martin