Page 1 of 1
InputRequester position and size
Posted: Sat Feb 09, 2013 4:32 am
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!

Re: InputRequester position and size
Posted: Sat Feb 09, 2013 10:54 am
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
Re: InputRequester position and size
Posted: Sat Feb 09, 2013 1:07 pm
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.
Re: InputRequester position and size
Posted: Tue Dec 27, 2016 2:46 pm
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