Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with check box status.
#1
Hi
I wrote a small program for checking check box status.
When i push the "Button" it is checking the check box status and it is all the time 1.
It suppose to be 0 if check box unchecked. 
Can somebody please help me with this issue?
Thanks
Code:
Copy      Help
 
str dd=
 BEGIN DIALOG
 0 "" 0x90C80AC8 0x0 0 0 180 60 "Dialog" "4"
 3 Button 0x54032000 0x0 8 36 48 14 "Button"
 4 Button 0x54012003 0x0 8 16 48 10 "Check"
 1 Button 0x54030001 0x4 64 36 48 14 "OK"
 2 Button 0x54030000 0x4 120 36 48 14 "Cancel"
 END DIALOG
 DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""

str controls = "4"
str c4Che
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
case WM_INITDIALOG
case WM_DESTROY
case WM_COMMAND goto messages2
ret
 messages2
sel wParam
case IDOK
case IDCANCEL
case 3
int cChecked=val(c4Che); out "Check: %s" iif(cChecked "checked" "unchecked")
out cChecked
ret 1
#2
need to use DT_GetControls and v attribute on #sub DlgProc

Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 180 60 "Dialog" "4"
;3 Button 0x54032000 0x0 8 36 48 14 "Button"
;4 Button 0x54012003 0x0 8 16 48 10 "Check"
;1 Button 0x54030001 0x4 64 36 48 14 "OK"
;2 Button 0x54030000 0x4 120 36 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""

str controls = "4"
str c4Che
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 3
,DT_GetControls hDlg
,int cChecked=val(c4Che); out "Check: %s" iif(cChecked "checked" "unchecked")
,out cChecked
ret 1

can also do this

Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 180 60 "Dialog" "4"
;3 Button 0x54032000 0x0 8 36 48 14 "Button"
;4 Button 0x54012003 0x0 8 16 48 10 "Check"
;1 Button 0x54030001 0x4 64 36 48 14 "OK"
;2 Button 0x54030000 0x4 120 36 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""

str controls = "4"
str c4Che
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 3
,int cChecked=but(id(4 hDlg)); out "Check: %s" iif(cChecked "checked" "unchecked")
,out cChecked
ret 1
#3
Hi Kevin
It works.
Thank you for your help.
TNH


Forum Jump:


Users browsing this thread: 1 Guest(s)