Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Returning values from function to different dialog controls
#1
I know this should be easy, but I just can't grasp the logic on how it is done.

So if I choose option button 1 the text goes in text 1 and if I choose option button 2 the text goes into text 2?

Function Dialog2
Code:
Copy      Help
/Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages


;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 287 130 "Dialog2"
;3 Button 0x54032000 0x0 4 0 50 16 "Start"
;2 Button 0x54030000 0x4 6 20 48 14 "Cancel"
;5 Button 0x54032009 0x0 58 2 102 14 "Display in text box 1"
;6 Button 0x54002009 0x0 162 2 120 14 "Display in text box 2"
;4 Edit 0x54200844 0x20000 56 50 96 48 ""
;7 Edit 0x54200844 0x20000 168 50 96 48 ""
;8 Static 0x54000000 0x0 56 38 48 12 "Text Box 1"
;9 Static 0x54000000 0x0 168 38 48 12 "Text Box 2"
;END DIALOG
;DIALOG EDITOR: "" 0x2030408 "" "" "" ""

str controls = "5 6 4 7"
str o5Dis o6Dis e4 e7
o5Dis=1
if(!ShowDialog("Dialog2" &Dialog2 &controls)) ret
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,
,case WM_COMMAND goto messages2
,case WM_APP
,SetDlgItemText hDlg 4 F"{lParam%%s}"
,/SetDlgItemText hDlg 7 F"{lParam%%s}"


ret
;messages2
sel wParam
,case 3
,str showText
,if but(id(5 hDlg))
,,showText="text1"
,else
,,showText="text2"
,mac "Displaytext" "" hDlg showText
,
,,case IDCANCEL
ret 1

Function Displaytext
Code:
Copy      Help
function hDlg ~showText

if showText="text1"
,SendMessage hDlg WM_APP 1 "text is in text box 1"
else
,SendMessage hDlg WM_APP 1 "text is in text box 2"

Kind Regards
Matt


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)