function does not seem to support this. However, here's a proof-of-concept to a custom input requester, with some extended functions which can be easily modified as required. It includes the following features:
Code: Select all
Global irWin, irInput, irButton1, irButton2
Procedure InputRequester_X(title.s = "Custom Input Requester",
message.s = "Please input the required value:",
defaultValue.s = "", buttons.s = "OK")
wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_Tool
irWin = OpenWindow(#PB_Any, 0, 0, 300, 170, title, wFlags)
irMsg = TextGadget(#PB_Any, 30, 20, 240, 50, "")
irInput = StringGadget(#PB_Any, 20, 70, 260, 30, defaultValue)
If CountString(message, "|")
messages1$ = Trim(StringField(message, 1, "|"))
messages2$ = Trim(StringField(message, 2, "|"))
message = messages1$ + #CRLF$ + messages2$
EndIf
SetGadgetText(irMsg, message)
If CountString(buttons, "|")
buttonText1$ = Trim(StringField(buttons, 1, "|"))
buttonText2$ = Trim(StringField(buttons, 2, "|"))
irButton1 = ButtonGadget(#PB_Any, 20, 120, 120, 30, buttonText1$)
irButton2 = ButtonGadget(#PB_Any, 160, 120, 120, 30, buttonText2$)
Else
irButton1 = ButtonGadget(#PB_Any, 40, 120, 220, 30, buttons)
EndIf
EndProcedure
wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered
mainWin = OpenWindow(#PB_Any, 20, 20, 400, 300, "Custom Input Requester", wFlags)
mainInput = TextGadget(#PB_Any, 20, 70, 360, 30, "Input value: ")
inputButton1 = ButtonGadget(#PB_Any, 20, 140, 360, 40, "Input Requester With Default Values")
inputButton2 = ButtonGadget(#PB_Any, 20, 190, 360, 40, "1 Button / 1 Line Message / Close Timer")
inputButton3 = ButtonGadget(#PB_Any, 20, 240, 360, 40, "2 Buttons / 2 Line Message / No Close Timer")
clock = TextGadget(#PB_Any, 20, 20, 360, 40, "Time: 00:00:00", #PB_Text_Right)
SetGadgetColor(mainInput, #PB_Gadget_BackColor, #White)
AddWindowTimer(mainWin, 0, 1000)
Repeat
windowEvent = WaitWindowEvent()
Select EventWindow()
Case mainWin
Select windowEvent
Case #PB_Event_CloseWindow
appQuit = #True
Case #PB_Event_Timer
currentTime$ = FormatDate("%hh:%ii:%ss", Date())
SetGadgetText(clock, "Time: " + currentTime$)
If IsWindow(irWin)
If countDown > 1
countDown - 1
buttonText$ = Trim(StringField(buttonText$, 1, "|"))
countDown$ = " (" + Str(countdown) + ")"
SetGadgetText(irButton1, buttonText$ + countDown$)
ElseIf countDown <> -1
CloseWindow(irWin)
DisableWindow(mainWin, #False)
SetActiveWindow(mainWin)
EndIf
EndIf
Case #PB_Event_Gadget
Select EventGadget()
Case inputButton1, inputButton2, inputButton3
DisableWindow(mainWin, #True)
If EventGadget() = inputButton1
countDown = -1
InputRequester_X()
Else
If EventGadget() = inputButton2
countDown = 10 ;10-second close timer
title$ = "Input Requester 1"
message$ = "(wrapped lines) This requester will " +
"automatically close after 10 seconds..."
defaultText$ = "default text of 1-button requester"
buttonText$ = "OK"
Else
countDown = -1 ;no close timer
title$ = "Input Requester 2"
message$ = "Input message line 1... | Input message line 2..."
defaultText$ = "default text of 2-button requester"
buttonText$ = "OK | CANCEL"
EndIf
InputRequester_X(title$, message$, defaultText$, buttonText$)
EndIf
EndSelect
EndSelect
Case irWin ;inputRequester handler
Select windowEvent
Case #PB_Event_CloseWindow
countDown = 0
CloseWindow(irWin)
DisableWindow(mainWin, #False)
SetActiveWindow(mainWin)
Case #PB_Event_Gadget
Select EventGadget()
Case irButton1, irButton2
If EventGadget() = irButton1
SetGadgetText(mainInput, "Input value: " + GetGadgetText(irInput))
EndIf
countDown = 0
CloseWindow(irWin)
DisableWindow(mainWin, #False)
SetActiveWindow(mainWin)
EndSelect
EndSelect
EndSelect
Until appQuit