QB64 Phoenix Edition
A couple questions about the dialogs.... - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: A couple questions about the dialogs.... (/showthread.php?tid=2051)

Pages: 1 2 3


A couple questions about the dialogs.... - Dav - 09-30-2023

I'm making a utility program that doesn't use a main SCREEN at all, but instead relies on dialogs for interaction.  A couple questions, about the message dialog & input box.

1) Is the message dialogs display behavior the same on all OS's?  Will a CHR$(10) start a new line for everyone?

2) Is there a way to center the input box on the screen?

Here's an example of what I'm doing with those.  Giving away what I'm working on again - since _LOADIMAGE/_SNDOPEN has a "memory" option now, I had to reawaken the old QBV project.

- Dav

Code: (Select All)


_ScreenHide

lf$ = Chr$(10)
a$ = "QBV Video Builder v1.0." + lf$ + lf$
a$ = a$ + "This app builds an .QBV Audio/Video file from a" + lf$
a$ = a$ + "numeric sequence of images (ex: 000001.JPG, etc)" + lf$
a$ = a$ + "and an optional .OGG file.  You will be allowed" + lf$
a$ = a$ + "to specify a frame rate." + lf$ + lf$
a$ = a$ + "Please select a starting image file..."

_MessageBox "QB64 Video Builder", a$, "info"

result$ = _InputBox$("QBV Video Builder", "Frame rate p/s:", "15")

End



RE: A couple questions about the dialogs.... - TerryRitchie - 09-30-2023

(09-30-2023, 01:17 AM)Dav Wrote: I'm making a utility program that doesn't use a main SCREEN at all, but instead relies on dialogs for interaction.
Well that's a cool idea!


RE: A couple questions about the dialogs.... - mnrvovrfc - 09-30-2023

I suggest instead using `CHR$(13)` because that's what it required on Win32 API. This should work with Zenity on Linux. I should check if it could work on Yad as well because more systems (EndeavourOS, MX Linux) are using that instead.

On Linux the "tinyfiledialogs" functionality of QB64 might control what is the size of the `_MESSAGEBOX` which could interfere with your intentions displaying a message. The only alternative, however, is to call the dialog-making tool directly. With Zenity provide `--width=xxx` option to set the width of the message box.

The dialog-maker should be responsible for keeping the dialog centered on the screen if it's possible. But it could depend on the desktop and/or window system settings. For example on XFCE desktop there is a threshold for how large a dialog has to be so it could be considered for centering. Otherwise it pretty much could place the dialog in one corner of the screen which is annoying. This is almost not thought of on KDE (which Neon has and you say you use it).


RE: A couple questions about the dialogs.... - Dav - 10-01-2023

Thanks for the advice, @mnrvovrfc.  CHR$(13) seems to work fine - I will switch to that.  So that question has been answered.  Thanks.

Also, I found if I do a _SCREENMOVE _MIDDLE *before* doing the _SCREENHIDE then the InputBox will be centered. 

- Dav


RE: A couple questions about the dialogs.... - mnrvovrfc - 10-01-2023

But...

https://qb64phoenix.com/qb64wiki/index.php/SCREENMOVE

Quote:Description:
:
Keyword not supported in Linux versions

However it would be pretty easy to replicate the functionality.

Code: (Select All)
SUB screenmiddle ()
DIM AS INTEGER dw, dh, ww, hh
dw = _DESKTOPWIDTH
dh = _DESKTOPHEIGHT
ww = _WIDTH
hh = _HEIGHT
ww = (dw \ 2) - (ww \ 2)
hh = (dh \ 2) - (hh \ 2)
_SCREENMOVE ww, hh
END SUB



RE: A couple questions about the dialogs.... - SMcNeill - 10-01-2023

Does _ScreenMove work at all on Linux?


RE: A couple questions about the dialogs.... - Dav - 10-01-2023

I just tested under Linux Mint.  _SCREENMOVE _MIDDLE seem to work.  It centers the screen to the middle.  Even without _SCREENMOVE to the middle,, it appears that the InuputBox is auto-centered anyway under Linux (Linux Mint).

- Dav


RE: A couple questions about the dialogs.... - mnrvovrfc - 10-02-2023

The Wiki was still saying `_SCREENMOVE _MIDDLE` doesn't work on Linux and I just took the word for it, but my tests on GNOME and KDE proved me wrong. In case it doesn't work, I provided a workaround. Each to their own.


RE: A couple questions about the dialogs.... - Dav - 10-02-2023

It’s a good workaround, would use it if needed.  I’m still learning the Linux differences. I swear my laptop battery last much longer under Linux.

- Dav


RE: A couple questions about the dialogs.... - TerryRitchie - 10-02-2023

(10-02-2023, 04:50 PM)Dav Wrote: It’s a good workaround, would use it if needed.  I’m still learning the Linux differences. I swear my laptop battery last much longer under Linux.

- Dav
It's not using all the extra CPU resources to to spy and upload your personal information to the mother ship (Microsoft). Big Grin