I've got a problem that seems simple.. I'm creating a golf application on an 8" Windows 11 Tablet (with a touch-screen).
Because the built-in tablet keyboard takes over the available screen space, I decided to create numerical 'buttons' on the bottom of a 593px x 1024px screen.
The form looks wonderful, and works great on my development computer. The issue: I have many InputRequester() and MessageRequester() procedures in the program, and they all work well with a keyboarded computer, but on a touch-screen the InputRequester() steals the focus, and won't allow my 'buttonKeys' to enter information into the requester.
Can the InputRequester() and MessageRequester() be made 'NON-MODAL'?
This is a Windows only app.. so Windows API would work for me. Thanks in advance.
Requester() issues
Requester() issues
- It was too lonely at the top.
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Re: Requester() issues
The MessageRequester is easy to replace by API MessageBox.
You must reprogram the InputRequester and replace the existing one with macro.
You must reprogram the InputRequester and replace the existing one with macro.
Code: Select all
MessageBox_(0, "Hello World", "Info", 0)
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
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Requester() issues
Well I would do it this way (see code below).
It is a very light-weight template for doing multi windows apps.
Please bear in mind, that this is my favorite style with enums and one single main eventloop. But you can separate the events for each window or you can use the BindEvent functionality. (All up to you).
From my point of view, this could be a good start for your own MessageWindow, InputWindow, etc.
You can search the forum for much more. Look for "InputRequester" or "RequesterWindows" etc.
AFAIK the MessageBox_() function is a modal dialog box. The way mk-soft shows it only use no parent window, but still influences the event loop.
My template code (For all readers: Some windows API's are used for my convenience but not really needed):
It is a very light-weight template for doing multi windows apps.
Please bear in mind, that this is my favorite style with enums and one single main eventloop. But you can separate the events for each window or you can use the BindEvent functionality. (All up to you).
From my point of view, this could be a good start for your own MessageWindow, InputWindow, etc.
You can search the forum for much more. Look for "InputRequester" or "RequesterWindows" etc.
AFAIK the MessageBox_() function is a modal dialog box. The way mk-soft shows it only use no parent window, but still influences the event loop.
My template code (For all readers: Some windows API's are used for my convenience but not really needed):
Code: Select all
EnableExplicit
Enumeration EWindow 1
#WND_Main
#WND_ReqInput
#WND_ReqMessage
; tbc.
EndEnumeration
Enumeration EGadget 1
; WND_Main
#GDT_Main_btnInput
; tbc.
; WND_ReqInput
#GDT_ReqInput_imgIcon
#GDT_ReqInput_txtInfo
#GDT_ReqInput_strInput
#GDT_ReqInput_btnInput
; tbc.
; WND_ReqMessage
#GDT_ReqMessage_txtMessage
#GDT_ReqMessage_btnOK
; tbc.
EndEnumeration
#ProgramCaption$ = "Test "
#ProgramMainCaption$ = #ProgramCaption$ + "Ver. 0.0"
; ---
Procedure InputWindow(Info$, DefInput$="") ; more arguments like NParent, Size, ....
Protected hIcon
If IsWindow(#WND_ReqInput)
HideWindow(#WND_ReqInput, 0)
SetActiveGadget(#GDT_ReqInput_strInput)
SendMessage_(GadgetID(#GDT_ReqInput_strInput), #EM_SETSEL, $FFFF, $FFFF)
ElseIf OpenWindow(#WND_ReqInput, 0, 0, 320, 112, #ProgramCaption$, #PB_Window_SystemMenu|#PB_Window_WindowCentered, WindowID(#WND_Main))
hIcon = LoadIcon_(0, #IDI_WINLOGO) ; acc. to MSDN: default winlogo
ImageGadget(#GDT_ReqInput_imgIcon, 8, 8, 32, 32, hIcon)
TextGadget(#GDT_ReqInput_txtInfo, 48, 8, 320-56, 24, Info$)
StringGadget(#GDT_ReqInput_strInput, 48, 32, 320-56, 24, DefInput$)
SendMessage_(GadgetID(#GDT_ReqInput_strInput), #EM_SETSEL, $FFFF, $FFFF) ;
ButtonGadget(#GDT_ReqInput_btnInput, 128, 80, 64, 24, "OK")
SetActiveGadget(#GDT_ReqInput_strInput)
EndIf
EndProcedure
; ---
Procedure MessageWindow(Message$, Flags)
; tbc.
EndProcedure
; ---
Procedure CreateMainWindow()
If OpenWindow(#WND_Main, #PB_Ignore, #PB_Ignore, 400, 240, #ProgramMainCaption$, #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(#GDT_Main_btnInput, 160, 200, 64, 24, "Input")
ProcedureReturn #True
EndIf
ProcedureReturn #False
EndProcedure
; ---
Procedure Main()
Protected input$
If CreateMainWindow()
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case #WND_Main
Break ; bye
Case #WND_ReqInput
HideWindow(#WND_ReqInput, #True)
; ; or for all other windows
; Default
; HideWindow(EventWindow(), #True)
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case #GDT_Main_btnInput
InputWindow("Enter the new Value for somesthing....", "I don't know.")
Case #GDT_ReqInput_btnInput
input$ = GetGadgetText(#GDT_ReqInput_strInput) : Debug " Result = '" + input$ + "'"
; todo something ....
;CloseWindow(#WND_ReqInput) ; creates the window again next time
HideWindow(#WND_ReqInput, 1) ; this kept the position for the next time ???
; tbc.
EndSelect
EndSelect
ForEver
EndIf
ProcedureReturn 0
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).
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).
Re: Requester() issues
Thanks for this Axolotl, it didn't work, but it gave me a few ideas. Definitely challenging. 

- It was too lonely at the top.
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem