nsstudios wrote: ↑Fri Oct 23, 2020 6:44 pmYou've done an amazing job with this; it surely makes my life a lot easier!
Thanks, you are welcome.
nsstudios wrote: ↑Fri Oct 23, 2020 6:44 pmIt seems like supplying the multiline flag to a string gadget does nothing... for some reason.
Yes, you are right.
Because DynDialogs uses the PB internal Dialog functions, and they don't support any other Flags than original PB-Parameters, API-Parameter do not work here ... sorry.
And BP does not support changing Flags after the Gadget was generated, so you cannot add multiline afterwards using genuine PB functions.
But ... maybe you could use API functions to add multiline support afterwards - I bet you will find some information about this here in the forum.
Or ... why not just use an EditorGadget() instead of StringGadget()? Afaik, PBs EditorGadget() is nothing else than a multiline StringGadget().
Looking at your example, I found some problems within your code.
e.g. you always give an ID AND a Name to a Gadget.
Further you try to give an ID to commands like hBox() or vBox(), which require 'parameters', but no ID.
In the beginning, it's sometimes a bit hard to understand the logic behind PBs Dialog-Library and how to use it.
For further information about the possibilities and how to correctly use its functions, please have a look at the description for
OpenXMLDialog() in the PuraBasic Reference Manual
TIPP: PB usually gives you some Syntax-Help for a command down in the Status-Bar. If you open the DynamicDialogs Include-Files in another IDE-Tab, you will get Syntax-Information about the DynDialog-Commands in the Status-Bar as well (this depends on your IDE settings, but it's very helpful to enable this). For further information about the parameters, pls. look at the PB-Manual (see link above). For available and helpful #constants, supported by DynamicDialogs (like for '#Alignment'), pls have a look at the Sorce code in DD Main-Modul.
Attached pls find an edited version of your example with some comments and EditorGadget() instead of StringGadget():
(I used thy 'suffixed_IDonly' Modul-Version here, instead of the 'plain'-Version. More info about that see comment below.)
Code: Select all
EnableExplicit
XIncludeFile "d:\Eigene Dateien\Programmierung\PureBasic\DynamicDialogs\DynamicDialogs_suffixed_IDonly.pbi"
Enumeration gd: #c1: #l1: #msg: #l2: #l: #l3: #d: EndEnumeration
UseModule DynamicDialogs
UseModule DynamicDialogs_suffixed_IDonly
Window__(0, "test", #Add_MenuSpacer | #Add_StatusBarSpacer | #PB_Window_ScreenCentered|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget, 800, 600,400,400)
vBox__(1) ; I added a vBox(), because I added a "resize me" Textbox at the Ende, which I want to stay at the bottom the whole time. To realize this, use vBox(1) to only expand its first child
Container__(#c1) ; a container is not really needed here, - pls remember: PB Dialog container only accept ONE direkt child-element, you need to cover following elements in one major element (like a hBox() or a vBox())
vBox__() ; vBox() or hBox() have NO ID, only parameters (in your example you placed an ID, where it was requesting a parameter) - pls see OpenXMLDialog()-Help to get more info on that
vBox__(2) ; vBox(2) will expand only his 2nd child-Elements - in this case, the String-Element
Text__(#l1, "message")
Editor__(#msg, "Test-Message")
String__(#PB_Any, "I'm a singlelined String-Gadget... edit me")
EndVBox__()
vBox__(2) ; vBox(2) will expand only his 2nd child-Elements - in this case, the ListIcon-Element
Text__(#l2, "chats")
ListIcon__(#l, "my ListView")
EndVBox__()
vBox__(2) ; vBox(2) will expand only his 2nd child-Elements - in this case, the String-Element
Text__(#l3, "details")
Editor__(#d, "Here are some Details ..."+Chr(10)+"blaa.."+Chr(10)+"blaablaa.."+Chr(10)+"blaaaa...", #PB_Editor_ReadOnly,#PB_Default,80)
String__(#PB_Any, "I'm a single-lined and readonly String-Gadget...", #PB_String_ReadOnly)
EndVBox__()
EndVBox__() ; close major-child from container
EndContainer__() ; close the container
Text__(#PB_Any, "resize me =>",0,#PB_Default,#PB_Default,#alignRight) ; now place an 'resize me' Text as 2nd vBox()-Child, which will be aligned right and will not be resized (see above)
EndVBox__() ; close the main vBox()-Frame, where only the first child (the container) was resized
EndWindow__()
OpenDialogWindow(0, GetXML())
;SetWindowState(0, #PB_Window_Maximize)
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
nsstudios wrote: ↑Fri Oct 23, 2020 6:44 pm
Btw, I don't really get the difference between plane and suffixed versions.
In functionality there is no difference.
But I think it makes a big difference if you use the Auto complete abilities of the PB-IDE and want to have working auto-indentation.
e.g. if you want to add a Text-Gadget, you type 'text' and Auto Complate gives you dozens of opportunities to choose from (at least with my IDE settings).
But by typing 'text_', Auto Complete only gives me my wanted 'Text__(' option from DynamicDialogs. So (at least for me), the suffixed Version is much more comfortable to use than the plain version.
Further the suffix is needed, if you want a working auto indentation for the DynamicDialogs command (which is VERY helpful - more on that further on).
Last but not least, I like the visual difference of the suffix compared to genuine PB commands, so I can immediately see in my code, what commands are from DynDialogs.
BUT !!! There is another Version I prefer most (and which I have used in my example above) - the
suffixed, ID only !!!
As you can see in the description about PBs Dialog Library in the reference Manual, you can create and identify a Dialog-Item either via ID-Number (as like all normal PB-Gadgets) or by a Name (given as a string).
Looking at your original example, this could cause a bit confusion as you have given an ID AND a Name for a Gadget ... and sometimes the same NAME for two different Gadgets.
Usually this is ment as an Either-OR ... not as an AND. So, because the Dialog-Library supported this, I included this in my Wrapper.
But as a PB-Programmer (who is used in identifying an Item via ID-Number) I think it's a bit annoying, that the syntax always requires a name, even I never use it.
So ... as an alternative to the 'original' plain- and suffixed-version, which require parameters for both (ID and NAME - even is the name is empty=""), I created an 'ID-Only' and a 'Name-Only' Version, for those programmers, who prefer the either or the other way. The Syntax in these Versions require either only the ID or only the Name - which is more clear to me.
And ... looking at your original example code ...
I think the ID-Only Version will be the right one for you (because you always try to give an ID).
Futher: INDENTATION !!! ... to improve the readability of a code, I think indentation is a big thing.
Because the BP-IDE does not know the DynDialogs commands and so it does not do any indentation on them, I've created a little tool, which 'teaches' the IDE how to indent the DynDialog commands right.
This is only available for the 'suffixed' Modul-Versions, because to make sure, the indentation for DynamicDialogs does not interfere with other commands (e.g. an indentation on "Container" for a Container()-Element will also indent all other PB-Commands, starting with 'Container'), a suffix is required, to uniquely identify the DynamicDialogs command.
Pls. see and run the 'IDE-Indentation Help-Tool', included in the DynDialogs-Zip file.
NOTE: You HAVE TO CLOSE the IDE first and also HAVE TO RUN this program as Admin-User.
Hope this info could help to blow away a bit of the magic fog around PB Dialogs or my DynamicDialogs.
Greets, PL.