SaveFileRequester() ~ Position in application window

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

SaveFileRequester() ~ Position in application window

Post by RichardL »

Hi,

Please could the file Save and Open requesters (and others?) centralize themselves in the window of the calling PB application, or at least close to the mouse position.
In my view this should be standard practice and not require special coding tricks to achieve.

A good way to do this would be to add an optional parent window ID along the same lines as OpenWindow(). This would be a consistent and backward compatible way of doing it.

I and my customers run two or more screens on their PC and it is confusing for requesters to appear on the wrong screen!

(In a recent television interview the author Terry Pratchett said that he had six screens on his PC because his desk was not big enough for eight. :) )

RichardL
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post by Michael Vogel »

I'll open a (dummy) window before using a file selector to get it cenetered -- crazy, but the only workaround I know...

Michael
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: SaveFileRequester() ~ Position in application window

Post by PB »

Do a search for setting the requester position, there's millions of examples.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

But they already do this (the default position is near the top left corner of the window, because that's where the mouse pointer is likely to be after selecting File->Open or File->Save).

Code: Select all

OpenWindow(0, 0, 400, 512, 384, "");, #PB_Window_SystemMenu)

  StandardFile$ = "C:\autoexec.bat"
  Pattern$ = "Text (*.txt)|*.txt;*.bat|PureBasic (*.pb)|*.pb|All files (*.*)|*.*"
  File$ = SaveFileRequester("Please choose file to save", StandardFile$, Pattern$, 0)
  
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

Post by RichardL »

Hi,
Michael, you are admitting to a crazy workaround, and PB comments that there are millions of examples… I think that you both make a good case for Pure Basic “doing it properly”, no tricks, no workarounds, just a neat and consistent solution that lets programmers focus on solving the real application problem and not overcoming language deficiencies (of which PB has few).

Trond.
Sorry, but your comment is not always true. My display consists of two 1600 x 1200 screens and requesters have a life of their own. They open almost anywhere; but most often close to where the application originally opened.

Best regards to you all.
RichardL
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

RichardL, I can confirm that. The other bad choice is in the middle, where they end up one half on the left screen, one half on the right one.

Even worse, one of the programs I use doesn't let you drag their alert widnow, so it's either live with it or go away :-)

Now I like to brag about my two 22" TFT's from DELL, 1680x1050 + 1680x1050... but I feel rather stupid when in the head of the moment (the demo effect :-)) a requester pop's up in the middle...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply