Index Parent

TheBar class


TheBar class is used to create image buttons bars.

TheBar is a subclass of TheBar.mcc so you must have TheBar.mcc, TheBarVirt.mcc and TheButton.mcc in MUI:Libs/MUI to use it.

Note that TheBar is a group: Horiz attribute may be used to control the horient of the bar; other Group class attribute should'nt be used.

If you need the buttons to be in a Virtgroup, use TheBarVirt.

 

TheBar.rxmec is also an ARexx shared library.

You don't have to worry about adding TheBar.rxmec to the ARexx libraries list, because it is done automatically.

 

TheBarNotify

Adds a notification.
Synopsis
res = TheBarNotify(notifier,button,attr,value,target,method,parameters)
<notifier/V>,<id/N>,<attr/V>,<value>,<target/V>,<method/V>,{parms}
Function
Adds a notification from notifier, a TheBar object button with id button, to target triggered by attr when it changes to value invoking method on target with parms.

You may use this function only with TheBar objects, when you want to set up a notify triggered by a TheBar button.

attr may be one of:

  • Disabled
  • Pressed
  • Selected
  • Timer

Inputs
notifier - the object that notifies
id - the id of a button of the bar (0,...)
attr - the attribute that triggers the notification
value - the value of attr that causes the notification
target - the target of the notification. Specials values are:
  • _app - the application notifier belongs to
  • _win - the window notifier belongs to
  • _self - notifier itself
method - a valid an indirect method to invoke on target
parms - parameters for method 
Result
res - 0 for success or >0 for failure
The function may fail if:
[NO_OBJ] notifier or target not found
[NO_METHOD] method is not valid for target
[METHOD_NONOTIFY] method is direct-only
[BAD_NOTIFY] the notification can't be added for some reason
See
Notification

 

To create a bar, you must define two things:

Images may be defined in two way:
Note that you may supply selected pics in spics and disabled pics in dpics or in SelStrip and DisStrip.
Buttons are defined listing them, as in
    tb.0.ID=0
    tb.0.Img=0
    tb.0.Text="Back"

    tb.1.ID=1
    tb.1.Img=1
    tb.1.Text="Forward"
    tb.1.Flags="Immediate selected"

 

Bar attributes
Name Type Class Note
Active N ISGN This is the active button in a mutual exclude set of buttons. Note that if just one mutual exclude set is defined, this attribute may be used for notification of the active one; if more that one mutual exclude set is defined in the same TheBar, this attribute reflects the last set active button in a set of mutual exclude buttons and notifications triggered by active buttons must be set up via the attribute Selected of any single button.
AutoID B I At init time, buttons are auto numbered, so you don't have to specify the ID attribute of any button
BarCols N ISGN The number of the columns of the bar
BarPos M ISGN G2N A number or one of:
  • Left
  • Center
  • Right
  • Up
  • Down
BarRows N ISGN The number of the rows of the bar
BarSpacer B ISGN Any button spacer becomes a bar spacer
BorderLess B ISGN If 1, you get borderless buttons
DisStrip S I Disabled images strip
DragBar B I The bar has a drag bar
EnableKeys B ISGN Enable key short cuts
Framed B I The bar frame is drawn
Free B ISGN Make the bar is x-y unlimited
FreeHoriz B ISGN Make the bar is x unlimited
FreeVert B ISGN Make the bar is y unlimited
Horiz B IS This is a Group attribute, but there is some more to say when used with TheBar. It controls the orient of the bar, so if 0, you get a vert bar, if 1 you get a horiz bar. It also controls the width of the bar when set: if 0 the bar is y unlimited, if 1 the bar is x unlimited. To prevent this, set FreeHoriz/FreeVert after.
LabelPos M ISGN G2N A number or one of:
  • Bottom
  • Top
  • Right
  • Left
Limbo B S Hummmmmm
PicsDrawer S I Path to the drawer where images are
Raised B ISGN If set to 1, you get mouse-raised buttons
Remove M ISGN G2N Remove spacers, a number or a combination of
  • Bars
  • Buttons
  • Images
  • All
Scaled B ISGN If 1, you get scaled images
SelStrip S I Selected images strip
SpacerIndex N I The index of the image spacer pic
Strip S I The name of a picture to load via datatype; it must contains all the buttons pics, in a horiz image with a single pixel column between each pics; the number of the pics is derived from the buttons number or from the StripButtons attribute
StripCols N I The number of the columns in the strip
StripHorizSpace N I The pixels beetween two colums in the strip; default 1
StripRows N I The number of the rows in the strip; default 1
StripVertSpace N I The pixels beetween two rows in the strip; default 1
Sunny B ISGN If set to 1, you get mouse-sunny images
TextOnly B G If, for any reason, the image of a button can't be read, this attribute is set to 1 and TheBar falls back to Text ViewMode
ViewMode M ISG G2N A number or one of:
  • TextGFX
  • GFX
  • Text

 

Buttons attributes
Name Type Class Note
Exclude N I Mutual exclude mask. Note that more than one set of mutual exclude buttons may be specified in a single TheBar.
ID N I The ID of the button
Img M I Which pic this button uses or one of the special values:
  • Bar - add a bar spacer
  • Button - add a space with the same size of the buttons
  • Image - add an images spacer; the picture specified in SpacerIndex attribute is used to create a spacer; if SpacerIndex is not defined a bar spacer is created
Text S I The label for this button
Help S I Help string for this button
Flags S I A combination of:
  • Disabled - the button is disabled
  • Hide - the button is hidden
  • Immediate - Immediate InputMode
  • NoClick - None InputMode
  • Selected - the button is selected
  • Sleep - the gfx stuff of the button are not created and the button is hidden
  • Toggle - Toggle InputMode
Note that default InputMode is RelVerify; see SetAttr method about Hide and Sleep

 

Methods
Name Parameters Note
TheBarAdd <button/V> Add a button, defined in button, to the bar.
TheBarGet <ID/N><attr><var/SN> Read the attribute of the button with ID ID and store its value in var
attrs is one of:
  • Hide
  • Sleep
  • Selected
  • Disabled
  • Timer
TheBarSet <ID/N><attr><value> Set the attribute of the button with ID ID to value
attrs is one of:
  • Hide
  • Sleep
  • Selected
  • Disabled
  • Timer

 

Example

    mgroup.0="tb"
     tb.class="TheBar"
     tb.Horiz=1
     tb.PicsDrawer="Pics"

      /* Define the pics */
      tb.Pics.0="back"
      tb.Pics.1="forward"
      tb.Pics.2="reload"
      tb.Pics.3="stop"
      tb.Pics.4="home"
      tb.Pics.5="find"

      /* Define the buttons */

      /* ID:0 - Image:"back" */
      tb.0.ID=0
      tb.0.Img=0
      tb.0.Text="Back"

      /* ID:1 - Image:"forward" */
      tb.1.ID=1
      tb.1.Img=1
      tb.1.Text="Forward"
      tb.1.Flags="Immediate selected"

      tb.2.ID=2
      tb.2.Img=2
      tb.2.Text="Reload"
      tb.2.Flags="Immediate"

      tb.3.ID=3
      tb.3.Img=3
      tb.3.Text="Stop"
      tb.3.Flags="Toggle"

      /* A bar spacer */
      tb.4.Img="Bar"

      tb.5.ID=5
      tb.5.Img=4
      tb.5.Text="Home"
      tb.5.Flags="Immediate Selected"
      tb.5.Exclude=2**6

      tb.6.ID=6
      tb.6.Img=5
      tb.6.Text="Find"
      tb.6.Flags="Immediate"
      tb.6.Exclude=2**5

      tb.7.Img="Bar"
      tb.8.ID=8
      tb.8.Img=4
      tb.8.Text="Home"
      tb.8.Flags="Immediate Selected"
      tb.8.Exclude=2**9

      tb.9.ID=9
      tb.9.Img=5
      tb.9.Text="Find"
      tb.9.Flags="Immediate"
      tb.9.Exclude=2**8