InputRequester position and size

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

InputRequester position and size

Post by MachineCode »

Can InputRequester have optional X/Y open position parameters, please? I want it pop-up where I click the mouse, or anywhere I choose, really. Center of desktop is not always desirable, especially on a widescreen monitor where my app's window is docked to the far right edge, and the InputRequester opens up way over to the left. :?

And also, making it a bit wider and taller (maybe double what it is now?) would allow more text to be used for the prompt message. For example, I'd like to be able to have two lines of prompt text, on a double-width requester of what it is now. Currently, you can't put very much prompt in it for the user; and on a large widescreen monitor, it's microscopic! :)
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: InputRequester position and size

Post by c4s »

An additional option for the position? Well, then at least the MessageRequester() (and probably the other "requesters" - OpenFile, Printer, Color etc.) would need it too.

About the size option: I think automatically adjusting the width and multi-line support would be even better... InputRequester() Message$ -> Auto width & multiple lines
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: InputRequester position and size

Post by MachineCode »

The InputRequester is the only Fred-built requester, so he can do these requests. The other requesters are standard Windows libs, so he can't touch them. Ah, MC Hammer.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
dougmo52usr
User
User
Posts: 62
Joined: Mon Jul 18, 2016 6:43 pm

Re: InputRequester position and size

Post by dougmo52usr »

I know it's an old question, but I had the same one. This seems to work on Win7Pro.

Code: Select all

Structure NameTo
  Title$
  pt.Point
EndStructure

Procedure DisplayInputRequesterAtBottomCenterOfGadget(Gadget)
  Protected ir.NameTo
  ir\Title$ = Title$
  ir\pt\x = GadgetX(Gadget,#PB_Gadget_ScreenCoordinate)+GadgetWidth(Gadget)/2
  ir\pt\y = GadgetY(Gadget,#PB_Gadget_ScreenCoordinate)+GadgetHeight(Gadget)
  CreateThread(@MoveInputBox(),@ir)
  ProcedureReturn InputRequester(Title$,Text$,Min$)
EndProcedure

Procedure EnumWindowProc(hwnd,lParam)
  Protected *p.NameTo = lParam
  Protected Title$ = Space(#MAX_PATH)
  If GetWindowText_(hwnd,@Title$,Len(Title$))
    If Title$ = PeekS(@*p.NameTo\Title$)
      Protected r.RECT
      If GetWindowRect_(hwnd,@r)
        Protected w = r\right-r\left
        Protected h = r\bottom-r\top
        Protected x = *p.NameTo\pt\x
        Protected y = *p.NameTo\pt\y
        MoveWindow_(hwnd,x,y,w,h,1)
        ProcedureReturn 0
      EndIf      
    EndIf    
  EndIf
  ProcedureReturn 1
EndProcedure
    
Procedure MoveInputBox(*p.NameTo)
  Debug "MoveInputBox looking for '" + *p\Title$ + "'"
  While EnumWindows_(@EnumWindowProc(),*p)
    Sleep_(0)
  Wend  
  Debug "MoveInputBox exited"
EndProcedure
__________________________________________________
Code tags added
12.01.2017
RSBasic
Post Reply