Author |
Topic: Dialog box question (Read 402 times) |
|
CharlesB
New Member
member is offline


Gender: 
Posts: 46
|
 |
Dialog box question
« Thread started on: Apr 13th, 2015, 11:43pm » |
|
Sorry if I inundate this message board with questions, but I am stumped on this dialog box. I have been studying how to make these boxes, and I don't see why the one below does not work.
The user is supposed to inter an OD, and either an ID or a wall. (I would like to limit the user to either an ID or a wall, but that would be for a later time when I learn more).
I seem to be able to get a value for the OD, and the wall, but I cannot get a value for the ID.
Can someone please give me some advise as to what I am doing wrong. Many thanks, Charles Code:
INSTALL @lib$+"WINLIB2"
BS_DEFPUSHBUTTON = &1
CB_ADDSTRING = &143
CB_SETCURSEL = &14E
CBS_DROPDOWNLIST = &3
ES_AUTOHSCROLL = &80
ES_NUMBER = &2000
LB_ADDSTRING = &180
LB_GETCURSEL = &188
UDM_SETRANGE = &465
UDS_ALIGNRIGHT = &4
UDS_AUTOBUDDY = &10
UDS_SETBUDDYINT = &2
WS_CHILD = &40000000
WS_GROUP = &20000
WS_VISIBLE = &10000000
dlg%=FN_newdialog("NonStock Tubing", 20, 20, 160, 128, 8, 560)
PROC_groupbox(dlg%, "Group box", 0, 4, 4, 152, 96, WS_GROUP)
PROC_editbox(dlg%, "Enter OD", 101, 12, 20, 64, 12, ES_AUTOHSCROLL)
PROC_editbox(dlg%, "Enter ID", 102, 82, 20, 64, 12, ES_AUTOHSCROLL)
PROC_editbox(dlg%, "Enter Wall", 103, 82, 40, 64, 12, ES_AUTOHSCROLL)
PROC_pushbutton(dlg%, "OK", 1, 12, 108, 56, 14, WS_GROUP OR BS_DEFPUSHBUTTON)
PROC_pushbutton(dlg%, "Cancel", 2, 92, 108, 56, 14, 0)
PROC_showdialog(dlg%)
ON CLOSE PROC_closedialog(dlg%):QUIT
ON ERROR PROC_closedialog(dlg%):PRINT'REPORT$:END
Click%=0
ON SYS Click% = @wparam% : RETURN
REPEAT
WAIT 1
click%=0
SWAP Click%, click%
UNTIL click%=1 OR click%=2 OR !dlg%=0
IF click%=1 THEN
PRINT "OK pressed, settings were:"'
DIM text% 255
SYS "GetDlgItemText", !dlg%, 101, text%, 255
PRINT " OD Text box contained """$$text%""""
od=VAL($$text%)
SYS "GetDlgItemInt", !dlg%, 102, text%,255
PRINT " ID Text box contained """$$text%""""
id = VAL($$text%)
REM print "Number box contained ";Val%
SYS "GetDlgItemText", !dlg%, 103, text%, 255
PRINT " WALL Text box contained """$$text%""""
wall=VAL($$text%)
SYS "IsDlgButtonChecked", !dlg%, 107 TO cb%
IF cb% PRINT "Checkbox was checked" ELSE PRINT "Checkbox was not checked"
ELSE
PRINT "Cancel pressed"
ENDIF
PROC_closedialog(dlg%)
|
|
Logged
|
|
|
|
Ian Kings
New Member
member is offline


Gender: 
Posts: 3
|
 |
Re: Dialog box question
« Reply #1 on: Apr 14th, 2015, 07:20am » |
|
Hi Charles,
It is because you are using GetDlgItemInt for the ID whereas you use GetDlgItemText for the OD and Wall.
If you intended to use number only editboxes then somthing like this should work. Code:SYS "GetDlgItemInt", !dlg%, 102, 0 ,FALSE TO id%
Ian
|
« Last Edit: Apr 14th, 2015, 07:29am by Ian Kings » |
Logged
|
|
|
|
CharlesB
New Member
member is offline


Gender: 
Posts: 46
|
 |
Re: Dialog box question
« Reply #2 on: Apr 14th, 2015, 4:57pm » |
|
O yes! So obvious now. Thank you Ian.
|
|
Logged
|
|
|
|
|