InputRequester pre-select flag
InputRequester pre-select flag
Here is a simple low-priority request:
A new flag for InputRequester (maybe #PB_InputRequester_Select) which will automatically pre-select all the text in the input field.
(We already have a Flags parameter for #PB_InputRequester_Password!)
It is handy for quick InputRequesters with DefaultText, so the user can immediately start typing to replace it. No need to keep hitting Ctrl+A or using the mouse to select every time.
In my experience, it is more common to type over the DefaultText completely, rather than append to the end -- where the cursor currently defaults.
A new flag for InputRequester (maybe #PB_InputRequester_Select) which will automatically pre-select all the text in the input field.
(We already have a Flags parameter for #PB_InputRequester_Password!)
It is handy for quick InputRequesters with DefaultText, so the user can immediately start typing to replace it. No need to keep hitting Ctrl+A or using the mouse to select every time.
In my experience, it is more common to type over the DefaultText completely, rather than append to the end -- where the cursor currently defaults.
-
- Addict
- Posts: 4527
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: InputRequester pre-select flag
+1
Also for StringGadget(), such a flag would be nice to have.
Also for StringGadget(), such a flag would be nice to have.
Re: InputRequester pre-select flag
Up until today, I thought that the behavior of the Input Requester in Linux which preselects the default was best.
However a couple of hours ago I implemented a chat program where the user initiates text entry by pressing a key.
That key is captured and passed into the Input Requester as the first character of the user's input.
On Windows® that approach works well, because the text is not preselected, and the user continues to type the chat message naturally without interruption then hits the enter key to send it on its way.
With the preselected requester input on Linux, the second keystroke wipes out the first one which is not nice.
Indeed kenmo, a pre-selection option setting would be a good solution .
However a couple of hours ago I implemented a chat program where the user initiates text entry by pressing a key.
That key is captured and passed into the Input Requester as the first character of the user's input.
On Windows® that approach works well, because the text is not preselected, and the user continues to type the chat message naturally without interruption then hits the enter key to send it on its way.
With the preselected requester input on Linux, the second keystroke wipes out the first one which is not nice.
Indeed kenmo, a pre-selection option setting would be a good solution .
Keep it BASIC.
-
- User
- Posts: 49
- Joined: Wed Dec 17, 2014 11:54 am
Re: InputRequester pre-select flag
Good request.
I would like to also request that the InputRequester window be larger, too. It's positively small for any meaningful entry, especially on big monitors.
I would like to also request that the InputRequester window be larger, too. It's positively small for any meaningful entry, especially on big monitors.
Re: InputRequester pre-select flag
I discovered one way to make it wider.PB Fanatic wrote:I would like to also request that the InputRequester window be larger, too. It's positively small for any meaningful entry, especially on big monitors.
Code: Select all
InputRequester("SOFTWARE","message","string")
InputRequester("SOFTWARE","_______________________message_______________________","string")
InputRequester("SOFTWARE"," message ","string")
Keep it BASIC.
-
- User
- Posts: 49
- Joined: Wed Dec 17, 2014 11:54 am
Re: InputRequester pre-select flag
Doesn't make it wider here. All 3 requesters in your code sample are the same width.
Re: InputRequester pre-select flag
It must be a Linux (only?) feature.
Sorry about that, but it is good to know about the compiler differences.
Sorry about that, but it is good to know about the compiler differences.
Keep it BASIC.
Re: InputRequester pre-select flag
Well, we didn't get it in the last four years so is there a way around it? (WinAPI is ok.)
( 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... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: InputRequester pre-select flag
Maybe u can send a #EM_SETSEL message to do that.blueznl wrote:Well, we didn't get it in the last four years so is there a way around it? (WinAPI is ok.)
https://docs.microsoft.com/en-us/window ... /em-setsel
- RSBasic
- Moderator
- Posts: 1218
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
Re: InputRequester pre-select flag
Have fun:
Code: Select all
EnableExplicit
Define EventID
Define Text$
Procedure RequesterCallBack(hWnd, uMsg, wParam, lParam)
hWnd = FindWindow_("InputRequester",#Null)
If hWnd
hWnd = FindWindowEx_(hWnd,#Null,"Edit",#Null)
If hWnd
SendMessage_(hWnd,#EM_SETSEL,5,10)
EndIf
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
If OpenWindow(0,0,0,500,400,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ButtonGadget(1,10,10,100,20,"InputReq.",0)
SetWindowCallback(@RequesterCallBack())
Repeat
EventID=WaitWindowEvent()
If EventID=#PB_Event_Gadget
Select EventGadget()
Case 1
Text$ = InputRequester("Enter text", "Enter a text:", "Predefined text")
If Text$
Debug Text$
EndIf
EndSelect
EndIf
If EventID = #PB_Event_CloseWindow
End
EndIf
ForEver
EndIf