Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
hidden dialog in function, howto return string value
#1
I have the below "call_ftest" function which takes 2 parameters.
- a textfile path (the function "ftest" changes it's contents)
- and a variable "txt_out", we will fetch the content of the changed textfile in this variable.

I want to output the contents of "txt_out" through the function "call_ftest"
There are other simple ways to get the content of the changed textfile.
But the goal of this question is, on how to return a variable that processed in a function that contains a dialog.
(the variable has been processed in the dialog and then should be returned).

Function call_ftest
Code:
Copy      Help
_s="$desktop$\test.txt"
str txt_out
ftest(_s txt_out)
out txt_out ;; OUTPUT "txt_out" HERE! (currently does not output anything)

In the above function "ftest", in "case WM_INITDIALOG..." It put's new content in variable "txt_out"
I want to output the new contents of "txt_out" in the function "call_ftest"


Function ftest
Code:
Copy      Help
function str'txtfile_in str&txt_out

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "TEST"
;3 Edit 0x54231044 0x200 3 2 218 130 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040308 "*" "" "" ""


str controls = "3"
str e3
if(!ShowDialog(dd &sub.DlgProc &controls 0 128)) ret


#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,,str s="abc"
,,s.setfile(txtfile_in)
,,txt_out.getfile(txtfile_in) ;; END DIALOG AND RETURN 'txt_out' IN FUNCTION "call_ftest"

,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#2
clo hDlg
#3
Off course...! I totally forgot about "clo", I used "end" and it didn't work.
It works with "clo"!
Thanks!


Forum Jump:


Users browsing this thread: 1 Guest(s)