[Implemented] Improve the input requester

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
jacdelad
Addict
Addict
Posts: 1991
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

[Implemented] Improve the input requester

Post by jacdelad »

I recently started using two monitors and encountered some inconsistencies in my code beside some annoyances. One it that the input requester is always shown on the primary monitor. So I hereby declare it would be a good idea to add an optional parameter for a parent window, which is used for alignment. A parent window would also give us the possibility to set whether it shall get its own icon on the taskbar or not.

Also I'm aware that I can easy peasy build an own dialogue, which I certainly will. Maybe with some more customizations, maybe worth releasing it into the Tipps&Tricks-section, maybe not.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Improve the input requester

Post by mk-soft »

jacdelad wrote: Tue Jan 17, 2023 4:51 pm Also I'm aware that I can easy peasy build an own dialogue, which I certainly will. Maybe with some more customizations, maybe worth releasing it into the Tipps&Tricks-section, maybe not.
Not worth it. There are already many ...
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
BarryG
Addict
Addict
Posts: 4123
Joined: Thu Apr 18, 2019 8:17 am

Re: Improve the input requester

Post by BarryG »

jacdelad wrote: Tue Jan 17, 2023 4:51 pmI recently started using two monitors and encountered some inconsistencies in my code beside some annoyances. One it that the input requester is always shown on the primary monitor.
Just be aware that some users with multiple monitors actually want that. I had a custom requester which I opened in the center of multi-monitors, and got negative (but polite) feedback from several people asking for an option to only show it on their main monitor. I even started a topic about it here recently (how to determine the primary monitor).
User avatar
jacdelad
Addict
Addict
Posts: 1991
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Improve the input requester

Post by jacdelad »

Oh ok.
Well, that's why I thought a few more options would be nice.

I'll simply create my own requesters, they'll suit me.

Thanks anyway.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Rinzwind
Enthusiast
Enthusiast
Posts: 679
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Improve the input requester

Post by Rinzwind »

It should indeed have an option to declare where it should be shown. Mainly primary monitor or the monitor that contains the active window. A simple quality of life improvement.
BarryG
Addict
Addict
Posts: 4123
Joined: Thu Apr 18, 2019 8:17 am

Re: Improve the input requester

Post by BarryG »

I agree that the request is valid, for sure. An optional parent window is a great idea. Just make that optional in your app for your users, is all I meant. Some will like it; some won't.
Axolotl
Addict
Addict
Posts: 802
Joined: Wed Dec 31, 2008 3:36 pm

Re: Improve the input requester

Post by Axolotl »

+1 to all requesters.
I personally use different methods to center dialogs to there parent windows. Would be cool, if that could be done by optional parameter.
In multi-monitor settings, special attention must be paid to the margins. Dialogs should not be displayed on/over two monitors, because the middle is hidden by the monitor margins.
I therefore move the dialogs to the monitor on which the dialog would be displayed predominantly, when I would not intervene....
Only some spontaneous thoughts in addition.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
BarryG
Addict
Addict
Posts: 4123
Joined: Thu Apr 18, 2019 8:17 am

Re: Improve the input requester

Post by BarryG »

Axolotl wrote: Wed Jan 18, 2023 11:59 amDialogs should not be displayed on/over two monitors, because the middle is hidden by the monitor margins.
Huh? No, they're not. The dialog/window is always split evenly over two monitors, with no parts missing. I've never seen part of a dialog/window that isn't visible due to being shared over two monitors at once. If it is for you, then that sounds like a physical monitor display setting issue, rather than the OS hiding the middle of the dialog/window. Show me an example if I'm wrong, because I'd like to see this.
Axolotl
Addict
Addict
Posts: 802
Joined: Wed Dec 31, 2008 3:36 pm

Re: Improve the input requester

Post by Axolotl »

Arghh, sorry.
Of course no information (pixels) is missing.
What I was trying to write is, that it doesn't look nice when a messagebox is drawn over two monitors.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
BarryG
Addict
Addict
Posts: 4123
Joined: Thu Apr 18, 2019 8:17 am

Re: Improve the input requester

Post by BarryG »

Oh, right. I thought you were saying the middle of the dialog was getting cut out by being in the center of two monitors, and I was Googling to find how a monitor margin setting might be doing that. I can stop looking now! Hehe.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Improve the input requester

Post by Tenaja »

There is a case that can create missing pixels when the dialog is overlapping screens... If you have a laptop and a monitor (my laptop is my primary setup), and the resolution does not match. When I got my 4k monitor before I upgraded my laptop, i dealt with this issue when using both screens.
Taz
User
User
Posts: 75
Joined: Sat Jan 20, 2018 5:28 pm
Location: Germany

Re: Improve the input requester

Post by Taz »

BarryG wrote: Wed Jan 18, 2023 11:15 am I agree that the request is valid, for sure. An optional parent window is a great idea...
+1

It's annoying the different behavior of the requesters.

situation; Main window is open on Monitor 2:
InputRequester always opens on main screen while MessageRequester opens on monitor 2.
When the main screen is off, the InputRequester opens on it, very stupid! :?

My opinion is that the requesters should always open on the monitor where the main window is open!

It would be nice if the behavior could be adjusted.
Fred
Administrator
Administrator
Posts: 18161
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Improve the input requester

Post by Fred »

Implemented in 6.10
Axolotl
Addict
Addict
Posts: 802
Joined: Wed Dec 31, 2008 3:36 pm

Re: [Implemented] Improve the input requester

Post by Axolotl »

Thanks for the new feature.
Just tried, but....
There must be an additional flag or something I do not know?

Code: Select all

EnableExplicit 

Enumeration EWindow 1 ; start with 1 (ZERO can be used for error detecting) 
  #WINDOW_Main 
EndEnumeration 

Enumeration EGadget 1 ; start with 1 (ZERO can be used for error detecting) 
  #GADGET_btnShowMessageRequester 

  #GADGET_btnShowInpuRequester 

  #GADGET_btnShowPathRequester 
EndEnumeration 

#Caption = "Test the new Requester Flags [???] " 

Procedure CreateMainWindow()  
  If OpenWindow(#WINDOW_Main, 40, 40, 280, 120, #Caption, #PB_Window_SystemMenu) 

    ButtonGadget(#GADGET_btnShowMessageRequester, 8, 24, 160, 24, "Show Message Requesters ") 
    ButtonGadget(#GADGET_btnShowInpuRequester, 8, 48, 160, 24, "Show Input Requesters ") 
    ButtonGadget(#GADGET_btnShowPathRequester, 8, 72, 160, 24, "Show Path Requesters ") 

  EndIf 

  ProcedureReturn IsWindow(#WINDOW_Main)  ; non-zero if valid window 
EndProcedure 

; --- main function ---------------------------------------------------------

Procedure main() 
  Protected tempStr.s 
  If CreateMainWindow() 
    Repeat 
      Select WaitWindowEvent()  
        Case #PB_Event_CloseWindow 
          Break 

        Case #PB_Event_Gadget 
          Select EventGadget()
            Case #GADGET_btnShowMessageRequester 

              MessageRequester(#Caption, "No Parent Window." + #LF$ + "So this works as always.", #PB_MessageRequester_Info) 

              MessageRequester(#Caption, "With Parent Window." + #LF$ + "So this doesn't work as expected.", #PB_MessageRequester_Error, WindowID(#WINDOW_Main)) 

            Case #GADGET_btnShowInpuRequester 
              tempStr = InputRequester(#Caption, "no parent window", "", 0) 
              tempStr = InputRequester(#Caption, "with parent window", "", 0, WindowID(#WINDOW_Main)) 
  
            Case #GADGET_btnShowPathRequester 

              PathRequester(#Caption, GetTemporaryDirectory()) 

              PathRequester(#Caption, GetTemporaryDirectory(), WindowID(#WINDOW_Main)) 

          EndSelect 
      EndSelect
    ForEver 
  EndIf 
EndProcedure 

End main() 
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Axolotl
Addict
Addict
Posts: 802
Joined: Wed Dec 31, 2008 3:36 pm

Re: [Implemented] Improve the input requester

Post by Axolotl »

I updated the code above...
Fun fact: The other requesters show up close to there parent windows without the new parameter!

Code: Select all

; ColorRequester() 
; FontRequester() 
; OpenFileRequester() 
; SaveFileRequester() 
I am pretty sure we need a small text with a brief description of the new parameters.
TIA.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Post Reply