What details are available for 'Dialog' library v5.20b2?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Demivec
Addict
Addict
Posts: 4086
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

What details are available for 'Dialog' library v5.20b2?

Post by Demivec »

I know an example was provided under the announcements of the beta and it included many things but I am hoping for some more information so I can test it.

With regard to the 'Dialog' library:
  • What functions are included and what do they do?
    What format does the XML file that contains the data for a dialog need to be in?
    I can sense a general outline that resembles gadget lists but is there another type of ordering or structure required?
    What tags are required (and what are they)?
    What attributes are permitted or required?
    How do you take advantage of the 'automatic layout' features?

Possible answers to the first question, here are some functions listed from the German PureBasic forum (probably obtain with the IDE's auto-complete).
  • BindEvent (Event, @Callback() [, Window [, Object [, Type]]]) - Bind an event to a callback.
    BindGadgetEvent (#Gadget, @Callback() [, EventType]) - Bind a gadget event to a callback.
    BindMenuEvent (#Menu, MenuItem, @Callback()) - Bind a menu item event to a callback.
    CreateDialog (#Dialog$) - Create a new dialog.
    DialogError (#Dialog) - Returns the error occured in the #Dialog creation.
    DialogGadget (#Dialog, Name$) - Returns the specified #Gadget associated with the dialog.
    DialogID (#Dialog) - Returns the unique ID which identifies the dialog in the operating system.
    DialogWindow (#Dialog) - Returns the #Window associated With the dialog.
    FreeDialog (#Dialog) - Free the specified dialog.
    IsDialog (#Dialog) - Tests if the given dialog is initialized.
    OpenXMLDialog (#Dialog, #Xml, Name$) - Create a dialog from an XML object.
    UnbindEvent (Event, @Callback() [, Window [, Object [, Type]]]) - Unbind an event callback.
    UnbindGadgetEvent (#Gadget, @Callback() [, EventType]) - Unbind a gadget event callback.
    UnbindMenuEvent (#Menu, MenuItem, @Callback()) - Unbind a menu item event callback.

@Edit: added possible list of functions.
Fred
Administrator
Administrator
Posts: 16623
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: What details are available for 'Dialog' library v5.20b2?

Post by Fred »

Here is a quick copy/paste of our internal header, it should help you to get started:

DialogError() can be used to investigate error when creating the XML dialogs.

Code: Select all

  Accepted keys in the XML by all objects:
 
  width  = specify a minimum dimension for the particular object
  height
 
  text  = literal string for display
  id    = Constant used for Gadget/WindowID. (PB_Any is used if not set)
  flags = extra gadget/window flags to set
  name  = name tag to know a gadget with Dialog\Gadget(Name)
 
  invisible = yes/no (default) - only for real gadgets/windows
  disabled  = yes/no (default) - only for real gadgets/windows

  onevent="ProcedureName()" ; needs to be a "Runtime" procedure
  
and for gadget which support and eventtype, it can be specified like this:

  onchange="OnChange()"
  onfocus="OnFocus()"
  etc. The name is the same than the #PB_EventType_<Name>
  
------------------------------------------------------------------------------------- 

  Shared functions for objects with one child. This is no object on its own

  Used by: window, container


  Accepted keys in the XML:

  margin = margin around the content (default = 10)
           can be a single number (= all margin), or a combination of
           top:<num>,left:<num>,right:<num>,bottom:<num>,vertical:<num>,horizontal:<num>
           example: "vertical:5,left:10,right:0"

  expand = yes        - expand child to fill all space (default)
           no         - no expanding
           vertical   - expand vertically only
           horizontal - expand horizontally only

  expandwidth  = max size to expand the children to. If the requested size is larger than
  expandheight   this setting then the request size is used (ie the content does not get smaller)
                 default=0

  align  = combination of top,left,bottom,right and center. (only effective when expand <> yes)
           example: "top,center" or "top,left" (default)
           
           
------------------------------------------------------------------------------------- 

 vbox, hbox

 Accepted keys in the XML:

 spacing   = space to add between the packed childs (default=5)

 expand    = yes           - items get bigger to fill all space (default)
             no            - do not expand to fill all space
             equal         - force equal sized items
             item:<number> - expand only one item if space is available

 align     = top/left      - only applied when expand="no", top/left is the default
             center
             bottom/right
             
------------------------------------------------------------------------------------- 

button, checkbox, option, listview, combobox, text, string

  Accepted keys in the XML:

   only the default options


  for ComboBox:
    boxheight = size of the dropdown Box (Default=200)

  for scrollbar:
    min, max, page


  Note: A ListIcon is created with 1 column, but if <column> is used, the default column is removed
  
------------------------------------------------------------------------------------- 
  
  gridbox - align elements in a table

  Accepted keys in the XML:

  columns = number of columns (default = 2)

  colspacing = space to add between columns/rows (default = 5)
  rowspacing

  colexpand = yes           - items get bigger to fill all space
  rowexpand   no            - do not expand to fill all space
              equal         - force equal sized items
              item:<number> - expand only one item if space is available

              for colexpand, Default=yes, For rowexpand, Default=no

  Any child within a gridbox can have these keys:

  colspan = number of columns to span (default = 1)
  rowspan = number of rows to span
  
------------------------------------------------------------------------------------- 
  
 multibox 
    A box with multiple childs in the same position. Used to put multiple containers
    inside and show only one of them at a time.
 
  Accepted keys in the XML:
 
  only the default options
  
------------------------------------------------------------------------------------- 
  
 panel - panel gadget

  The direct childs of a Panel must be "Tab" items, which are containers for the real gadgets

  Accepted keys in the XML:

------------------------------------------------------------------------------------- 

  tab - PanelGadget childs

  Accepted keys in the XML:

    All accepted by DlgBinBase
   
------------------------------------------------------------------------------------- 

scrollarea - ScrollAreaGadget()

  Accepted keys in the XML:

    All accepted by DlgBinBase

    The Childs will always get the size they ask for, exept if scrolling is set to one
    direction only and the gadget cannot grow.

  innerheight = inner minimal height (-1 = do not change)
  innerwidth  = inner minimal width  (-1 = do not change)
  step        = scrollstep value (default = 10)

  scrolling   = horizontal/vertical/both (default)
                force only one direction to be scrollable. the gadget will try to grow big
                enough to show all content in the other direction
                
------------------------------------------------------------------------------------- 

 singlebox
    A box with just one child. Used only to apply extra margin/alignment properties to a child.
    Its called a box (as all virtual containers are called that), but it extends DlgBinBase,
    because these are the properties we want.

  Accepted keys in the XML:

  all single container options

------------------------------------------------------------------------------------- 
  
 splitter - SplitterGadget()

  Accepted keys in the XML:

   firstmin  = pixel value or "request" (default)
   secondmin

  If firstmin or secondmin is set, they will be set for the gadget, if they are not set
  (or to "request"), the minimum will be the size request of the child.

  Note: The vertical mode is determined by the flags parameter

------------------------------------------------------------------------------------- 
 
 window

 Accepted keys in the XML:

    All accepted by DlgBinBase

   forcesize = yes/no (default)
               If the window is resizable, do not allow resizing below the
               requested minimum size

   closebutton = yes (default)/no
                 The default is to have the #PB_Window_SystemMenu flag on all dialogs
                 use this to remove it                                           
             
Fred
Administrator
Administrator
Posts: 16623
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: What details are available for 'Dialog' library v5.20b2?

Post by Fred »

Example with a gridbox:

Code: Select all

<?xml version="1.0"?>

<!-- Window -->
<window id="0" name="GridBoxWindow" text="Window" label="TestDialog" width="220" height="250" flags="#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget">
  <gridbox spacing="3" columns="2" expand="yes">
      <checkbox text="Run only one Instance" disabled="yes" Flags=""/>
      <progressbar text="Vrey vreyv rye dsqj jsqhdk hqskjdh kjqshd kjqhsdjk hqjkdh kjqhdk qhkj"/>
      <trackbar text="Ole" invisible="yes" Flags="   #PB_TrackBar_Ticks | #PB_TrackBar_Ticks|#PB_TrackBar_Ticks"/>
      <option text="option 1" />
      <option text="option 2" />
      <listview text="option 3" height="50" />
      <button text="Ole 2" />
      <listicon text="option 4" height="50" />
      <string text="string content" />
      <editor text="editorgadget" height="50" />
      <text text="Text gadget" />
  </gridbox>
</window> 
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: What details are available for 'Dialog' library v5.20b2?

Post by ts-soft »

Demivec wrote:What functions are included and what do they do?
Only for this point:
Image
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: What details are available for 'Dialog' library v5.20b2?

Post by Lunasole »

I was nicely surprised when moved my attention to that Dialog library when was playing recently with some XML stuff. Just though "why I didn't used that earlier?"
(maybe because there are no much topics about it on forum + I'm too lazy to spend time reading PB docs from the beginning to the end ^_^).

Currently I still not checked it well, but really it looks GREAT and very promising comparing to regular way of handling UI in PB. It even offers plain multi-line textbox, instead of that RTF editor (EDIT: I've missed, it is still editor gadget). What 'a leap of progress' anyway

PS. Can someone tell, is it DPI-aware in newer PB versions?
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
Post Reply