Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pass message to dialog before clicking OK
#1
Hello,

I have a dialog with a button that when a user clicks the button they can capture the active window. I want to be able to deactivate this button with a check box on the dialog before OK is clicked.

I have read the help and think it requires a dialog procedure? Help also lists examples for a combo and list box (CBN_SELENDOK LBN_SELCHANG)
but not for a check box. Is it possible to accomplish this with a check box ?

Many thanks.
#2
Function Dialog2
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Button 0x54032000 0x0 24 44 48 14 "Button"
;4 Button 0x54012003 0x0 24 28 48 10 "Check"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040800 "*" "" "" ""

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 4 ;;Check
,if(IsDlgButtonChecked(hDlg 4)) EnableWindow(id(3 hDlg) 0)
,else EnableWindow(id(3 hDlg) 1)
ret 1
#3
Works perfectly! Thank you kindly.


Forum Jump:


Users browsing this thread: 1 Guest(s)