I'm working on a project involving use of 'dlg lib'.
I am loading two values, AutoSave and AutoSort, from a settings file. Each of these values is either TRUE (yes, perform this action) or FALSE (don't perform the action).
I am creating a dialogue after loading these values and I've noticed that if the value is TRUE then the dialogue item does not exist (or at least it is not visible).
Is this a quirk of dlglib or a bug or a feature? If it's a feature then could someone please explain it's purpose?
Or am I just doing things in the wrong order?
Thanks in advance.
Joe.
Test Code:
Code: Select all
REM * dlglib quirk?
MODE 8
INSTALL @lib$+"dlglib"
PROC_setdialogpalette
OSCLI "FONT """+@lib$+"DejaVuSans"",10"
REM *** Test values ***
AutoSave=TRUE
AutoSort=FALSE
REM *******************
REM Create Dialogue
DLG_X_CENTRE=&80000000
DLG_Y_CENTRE=&80000000
PROCDlgOptions
dlg%=DlgOptions%
PROC_registerdlgcallback(dlg%,FNdlgcb())
PROC_setdialogtitle(dlg%,"Options")
d%=FN_showdialog(dlg%,DLG_X_CENTRE,DLG_Y_CENTRE)
REM d% holds index of any button which is pressed
PROC_closedialog(dlg%)
CASE d% OF
WHEN 1
REM 'OK' pressed
AutoSave=FN_isdlgitemchecked(dlg%,101)
AutoSort=FN_isdlgitemchecked(dlg%,102)
WHEN 2
REM 'Cancel' pressed - do nothing
ENDCASE
PRINT "AutoSave = ";AutoSave
PRINT "AutoSort = ";AutoSort
END
DEFPROCDlgOptions
LOCAL dlg%
LOCAL dw,dh,x,y,w_but,w,h
dw=128:dh=128
dlg%=FN_newdialog("",dw,dh)
x=16:y=14
w=80:h=12
PROC_checkbox(dlg%,"Auto Save",101,x, y,w,h,AutoSave)
PROC_checkbox(dlg%,"Auto Sort",102,x,2*y,w,h,AutoSort)
x=64:y=112
w_but=32
PROC_button(dlg%,"Cancel",2,dw-(2*w_but)-16,y,w_but,h,0)
PROC_button(dlg%,"OK" ,1,dw-w_but-8, y,w_but,h,0)
DlgOptions%=dlg%
ENDPROC
DEFFNdlgcb(D%,K%)
REM use keypress instead of mouse click; 13 = Enter (OK), 27 = Escape (Cancel)
IF K%=13 THEN =1
IF K%=27 THEN =2
=0