Whoa! I understand your frustration, but please try to keep your tone courteous!
Unfortunately given the limited documentation available (at least that I could find) I couldn't solve your problem in the time I was prepared to spend on it at the moment, but here's where I've got:
1) I note that the library says you must set the font and palette first, so I did that, but it doesn't solve the problem,
2) I set what looked like more sensible coordinates for displaying the new dialog. As with BB4W, dialogue box units do not match pixels/BBC plotting units, but that's OK.
With that, it at least displays the window before crashing...
I then pasted the FN_Showdialog out of the library, so it would use the local version, and I could play with it. Using breakpoints and print statements, I found where the issue is: it seems to crash around PROC_setptr (indicated below). I can't see why without really taking the routine to pieces....
Have you tried looking at the supplied dlgdemo program, to see if that helps?
A Google search threw up a conversation on this forum:
http://bbcbasic.co.uk/forum/viewtopic.php?t=959 that might be useful?
Best wishes,
D
Code: Select all
INSTALL@lib$+"dlglib"
MODE 21
REM Set font according to platform:
IF INKEY(-256) = &57 THEN
*FONT Segoe UI,10
ELSE
OSCLI "FONT """ + @lib$ + "DejaVuSans"",12"
ENDIF
PROC_setdialogpalette
PROCinit
END
:
DEFPROCinit
maindlg%=FN_newdialog("New Display",80,60)
showmain%=FN_showdialog(maindlg%,100,600)
WAIT 200
PROC_closedialog(maindlg%)
ENDPROC
DEF FN_showdialog(D%,X%,Y%) : LOCAL F%
LOCAL f%%,H%,I%,l%%,p%%,R%,click%(),ctl{},dlg{}
DIM click%(2)
DIM dlg{x%,y%,w%,h%,link%%,focus%%,nctrl%,backcall%%,bmp$,title$,scale}
DIM ctl{x%,y%,w%,h%,link%%,prev%%,id%,flags%,text$,handler%%}
PROC_setptr(dlg{},D%+PAGE-!340)
IF POS REM SDL thread sync.
IF X%=&FFFFFFFF80000000 dlg.x% = @vdu%!208 - dlg.w%/2 ELSE dlg.x% = (X% + 1) AND -2
IF Y%=&FFFFFFFF80000000 dlg.y% = @vdu%!212 - @char.y% + dlg.h%/2 ELSE dlg.y% = (Y% + 1) AND -2
ON MOUSE LOCAL click%() = @msg%,@wparam%,@lparam% : RETURN
H% = (@char.y% * 3 + 1) AND -2
dlg.bmp$ = @tmp$ + "dlg" + STR$(TIME) + ".tmp.bmp"
OSCLI "GSAVE """ + dlg.bmp$ + """ " + STR$dlg.x% + "," + STR$(dlg.y%-dlg.h%) + \
\ "," + STR$(dlg.w%+2) + "," + STR$(dlg.h%+2+H%)
GCOL 13
RECTANGLE FILL dlg.x%,dlg.y%,dlg.w%,H%
GCOL 15
MOVE dlg.x% + dlg.w%/2 - FN_stringwidth(dlg.title$)/2,dlg.y% + H% - @char.y%/2
VDU 5 : PRINT dlg.title$; : VDU 4
GCOL 0
RECTANGLE dlg.x%,dlg.y%-dlg.h%,dlg.w%,dlg.h% + H%
GCOL 7 + 128
VDU 24,dlg.x%+2;dlg.y%-dlg.h%+2;dlg.x%+dlg.w%-2;dlg.y%;
VDU 16,30,23,16,64|
l%% = dlg.link%%
FOR I% = 1 TO dlg.nctrl%
IF l%% = 0 EXIT FOR
PROC_setptr(ctl{},l%%)
ctl.prev%% = p%%
ctl.flags% = (ctl.flags% AND NOT WS_DARKMODE) OR F%
IF ctl.flags% AND WS_TABSTOP IF ctl.flags% AND WS_VISIBLE THEN
IF (ctl.flags% AND WS_DISABLED) = 0 dlg.focus%% = l%%
ENDIF
p%% = l%%
l%% = ctl.link%%
NEXT
ctl.link%% = dlg.link%%
PRINT ctl.prev%%
PROC_setptr(ctl{},dlg.link%%) :REM Crash seems to occur here
PRINT ctl.prev%%
ctl.prev%% = p%%
*REFRESH OFF
f%% = dlg.focus%%
IF f%% THEN
PROC_setptr(ctl{},f%%)
IF FN(ctl.handler%%)(dlg.x%,dlg.y%,f%%,DLG_GAINFOCUS,0,0)
ENDIF
PROC_refreshdialog(D%)
REPEAT
R% = FN_polldialog(D%,INKEY(5),click%())
UNTIL R% > 0
*REFRESH ON
f%% = dlg.focus%%
IF f%% THEN
PROC_setptr(ctl{},f%%)
IF FN(ctl.handler%%)(dlg.x%,dlg.y%,f%%,DLG_LOSEFOCUS,0,0)
dlg.focus%% = 0
ENDIF
VDU 24,0;0;@vdu%!208*2-2;@vdu%!212*2-2;4
= R%