Modeless dialogue box in BBCsdl

Discussions related to the code libraries supplied with BB4W & BBCSDL
svein
Posts: 58
Joined: Tue 03 Apr 2018, 19:34

Modeless dialogue box in BBCsdl

Post by svein »

Is it at all possible (in practical terms) to create a modeless dialogue box using dlglib.bbc ?
A quick test calling FN_polldialog() from the main did not work at all.

I can't decide wether to somehow use an edited version of FN_showdialog and FN_polldialog in/from the main program, or if i should just write the controls i need from scratch.
That would be: buttons, static, editboxes (text+numeric), checkboxes and a scrollable listbox with multiselect.

Any thought in the matter ?

Svein
Hated Moron

Re: Modeless dialogue box in BBCsdl

Post by Hated Moron »

svein wrote: Mon 23 Jan 2023, 11:55 Is it at all possible (in practical terms) to create a modeless dialogue box using dlglib.bbc ?
It all depends on what you want to do whilst the dialogue box is open.

If your interaction 'outside' the dialogue box might draw to (or scroll, etc.) the region of the screen where the dialogue box is displayed, then that can't work in a simple fashion because (unlike in Windows) it isn't a separate 'window' it's just a simple rectangular region of the screen. If you were to draw over the dialogue box, that is exactly what would happen! There is no concept of drawing behind it. ;)

All you can do in that case is to fake a modeless dialogue box by temporarily closing it, making the necessary changes to the region of the screen it occupies, then opening it again. That's how the Set Colours dialogue box in SDLIDE.bbc works, for example. It's fairly convincing if it happens quickly enough, but it's not really 'modeless' in the proper sense.

But if the things you want to do whilst the dialogue box is open don't involve drawing to or otherwise modifying the region of the screen where the dialogue box is displayed there's no particular difficulty. Most easily you can make your 'main loop' a procedure, then whilst the dialogue box is open you call that procedure from the dialogue box's periodic callback, which happens roughly every 5 cs (20 Hz).

I should perhaps add that if you are happy that your program can only run on a desktop platform (Windows, MacOS, Linux) then you can create genuinely multiple windows, which would allow you to put the dialogue box on a separate foreground window, just like in BB4W. But I don't recommend that, especially as it rules out running in a browser.
svein
Posts: 58
Joined: Tue 03 Apr 2018, 19:34

Re: Modeless dialogue box in BBCsdl

Post by svein »

Ok, it's no problem then.
I just thought about the problem backwards.
Thank you.

Svein