Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Returning values from function to different dialog controls
#6
A little stuck again Confusedhock:
I need to be able to return different values from macro to different dialog controls - this now works fine.

I am returning an integer to an edit box but I also need to be able to return a string to another edit box, but this must be able to scroll.

I can get either to work on their own, but not sure of the syntax needed to have them work together.

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


;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 287 130 "The Roulette Project"
;3 Button 0x54032000 0x0 6 4 50 38 "Start"
;4 Button 0x54032000 0x0 6 46 50 38 "Stop"
;9 Edit 0x54200844 0x20000 58 30 224 96 ""
;5 Button 0x54032009 0x0 58 2 102 14 "Dublinbet Table 1 #1/#10"
;6 Button 0x54002009 0x0 162 2 120 14 "Smartlive Low Limit Auto Roulette"
;8 Button 0x54012003 0x0 58 16 104 14 "Aggressive Betting Algorithm"
;7 Static 0x54000000 0x0 208 18 32 12 "Balance $"
;10 Edit 0x54032000 0x200 240 16 42 14 ""
;2 Button 0x54030000 0x4 6 88 50 38 "Close"
;END DIALOG
;DIALOG EDITOR: "" 0x2030408 "" "" "" ""

str controls = "9 5 6 8 10"
str e9 o5Dub o6Sma c8Agg e10
o5Dub=1
e10="100"

if(!ShowDialog("Hot_Dialog" &Hot_Dialog &controls)) ret
ret
;messages
sel message
,case WM_INITDIALOG
,/GdiObject- brush=CreateSolidBrush(ColorFromRGB(0 176 255))
,/SetDlgItemText hDlg 6 ""
,
,EnableWindow id(4 hDlg) 0
,case WM_DESTROY
,
,/case WM_CTLCOLORDLG ret brush
,case WM_COMMAND goto messages2
,case WM_APP
,SetDlgItemText hDlg wParam F"{lParam%%s}"
,SendMessage hDlg EM_SETSEL 1000000000 1000000000
,SendMessage hDlg EM_REPLACESEL 9 F"{lParam%%i}[]"
,
,
,//int c=id(9 hDlg)
,//SendMessage c EM_SETSEL 1000000000 1000000000
,//SendMessage c EM_REPLACESEL 0 F"{lParam%%i}[]"


ret
;messages2
sel wParam
,case 3
,SetDlgItemText hDlg 9 ""
,str toPlay
,int prog=0
,int TotalBalance
,
,if but(id(5 hDlg))
,,toPlay="Dub"
,else
,,toPlay="SL"
,if but(id(8 hDlg))
,,prog=1
,SetDlgItemText hDlg 3 "Running"
,EnableWindow id(3 hDlg) 0; EnableWindow id(4 hDlg) 1
,mac "Hot" "" hDlg toPlay prog _s.getwintext(id(10 hDlg))

,
,case 4
,SetDlgItemText hDlg 3 "Start"
,shutdown -6 0 "Hot"
,EnableWindow id(3 hDlg) 1; EnableWindow id(4 hDlg) 0
,
,case IDCANCEL
ret 1

Macro Hot
Code:
Copy      Help
function hDlg ~toPlay #prog #TotalBalance;;pass variable from dialog that determines which casino we are playing ;;set to 0 by default (i.e. no progression)

//double TotalBalance ;;game balance
//if(!inp(TotalBalance "Enter starting Balance" "Enter Your Balance" "0")) ret ;;prompt for starting balance to be entered
TotalBalance=TotalBalance+100
SendMessage hDlg WM_APP 9 "This is the first line"
SendMessage hDlg WM_APP 9 "This should appear below the first line"
SendMessage hDlg WM_APP 10 F"{TotalBalance}"

When I run this, the balance updates fine, but I am only seeing the second line in the other edit box, I need to have it scroll and show both.

Please can you assist?

Kind Regards
Matt


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)