This is something I've seen in a few programming languages and I think it would be really useful if also in PureBasic. It opens a Dialog (or the sort of Window you get when you do MessageRequester), but you can add your own controls to it. An example if you would like to see is in Python. wx.Dialog. I know PB already has a library called "Dialog" but you wouldn't have to make it it's own library, just add it to the "Gadget" section of the manual.
I hope you'll consider this
OpenDialog()
Re: OpenDialog()
I had a look at some images and they're just windows?Ty1003 wrote:Python. wx.Dialog.
Re: OpenDialog()
@Ty1003:
If I look at the examples of wx.Dialog, then the Dialog-Libary is exactly what you are looking for.
Or did I get you wrong?
If I look at the examples of wx.Dialog, then the Dialog-Libary is exactly what you are looking for.
Or did I get you wrong?
Hygge
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: OpenDialog()
Hi Ty1003
A Dialog is a Window with a defined, specific commonplace purpose. So they are provided because most apps need them.
However, if none of the standard ones suit your needs, you simply make your own - at the end of the day, they are all Windows.
A Dialog is a Window with a defined, specific commonplace purpose. So they are provided because most apps need them.
However, if none of the standard ones suit your needs, you simply make your own - at the end of the day, they are all Windows.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: OpenDialog()
Hi.
Yes, Dialogs are just Windows but they can contain text that's not in the window title but is read by ScreenReaders whenever alt tabbing back to it. EG, look at MessageRequester. Even with the #PB_MessageRequester_YesNo flag, the text is above both buttons, and I have not found a way to make custom Dialogs so that they behave like that.
Yes, Dialogs are just Windows but they can contain text that's not in the window title but is read by ScreenReaders whenever alt tabbing back to it. EG, look at MessageRequester. Even with the #PB_MessageRequester_YesNo flag, the text is above both buttons, and I have not found a way to make custom Dialogs so that they behave like that.
-
- Addict
- Posts: 4527
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: OpenDialog()
Your aim is to create a custom window that contains some text above some buttons?Ty1003 wrote:EG, look at MessageRequester. Even with the #PB_MessageRequester_YesNo flag, the text is above both buttons, and I have not found a way to make custom Dialogs so that they behave like that.
Re: OpenDialog()
I'm not 100 percent sure that's how MessageRequester() looks, as I am blind, but I believe so.
Allow me to give an example that I, hope, people will be able to understand.
MessageRequester("Question", "Copy this to clipboard?", #PB_MessageRequester_YesNo)
My screen reader (NVDA) would read this like the following.
"Question Dialog Copy to clipboard? Yes button Alt+Y"
But if I tab over to the "No" button, and then leave the Window and come back to it, I would hear.
"Question Dialog Copy to clipboard? No button Alt+N"
And that is what I'm trying to create, but with my own buttons of course, as if I only wanted Yes and No I would use MessageRequester .
Allow me to give an example that I, hope, people will be able to understand.
MessageRequester("Question", "Copy this to clipboard?", #PB_MessageRequester_YesNo)
My screen reader (NVDA) would read this like the following.
"Question Dialog Copy to clipboard? Yes button Alt+Y"
But if I tab over to the "No" button, and then leave the Window and come back to it, I would hear.
"Question Dialog Copy to clipboard? No button Alt+N"
And that is what I'm trying to create, but with my own buttons of course, as if I only wanted Yes and No I would use MessageRequester .
-
- Addict
- Posts: 4527
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: OpenDialog()
The following code is an example of a custom dialog. Is this what you are after?
Code: Select all
; PB 5.72
EnableExplicit
; Windows
#WinMain = 0
; Gadgets
Enumeration
#GadText
#GadBtn1
#GadBtn2
#GadBtn3
EndEnumeration
Procedure ShowDialog (title$, message$)
If OpenWindow(#WinMain, 20,20, 260,150, title$, #PB_Window_MinimizeGadget) = 0
MessageRequester("Fatal error", "Can't create main window.", #PB_MessageRequester_Error)
End
EndIf
TextGadget(#GadText, 50,30, 180,25, message$)
ButtonGadget(#GadBtn1, 20,100, 50,25, "Sure")
ButtonGadget(#GadBtn2, 90,100, 50,25, "Never")
ButtonGadget(#GadBtn3, 160,100, 80,25, "What's that?")
EndProcedure
Define event.i, reply$
ShowDialog("Custom dialog", "Do you want a cup of coffee?")
Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_Gadget
Select EventGadget()
Case #GadBtn1
reply$ = "Good choice!"
Case #GadBtn2
reply$ = "Do you prefer tea?"
Case #GadBtn3
reply$ = "That's a black magic fluid."
EndSelect
MessageRequester("Reply from the program", reply$, #PB_MessageRequester_Info)
EndSelect
Until event = #PB_Event_CloseWindow
CloseWindow(#WinMain)
- Jac de Lad
- Enthusiast
- Posts: 106
- Joined: Wed Jul 15, 2020 7:10 am
- Contact:
Re: OpenDialog()
I know these dialogues from XProfan. They have slightly different behaviour (ESC=Alt+F4 etc.), but mostly they don't have an icon in the title bar. Maybe this info helps.