Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A couple questions about the dialogs....
#1
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

Find my programs here in Dav's QB64 Corner
Reply
#2
(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!
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#3
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).
Reply
#4
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

Find my programs here in Dav's QB64 Corner
Reply
#5
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
Reply
#6
Does _ScreenMove work at all on Linux?
Reply
#7
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

Find my programs here in Dav's QB64 Corner
Reply
#8
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.
Reply
#9
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

Find my programs here in Dav's QB64 Corner
Reply
#10
(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
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply




Users browsing this thread: 1 Guest(s)