Aros/Developer/ZuneFurther

From Wikibooks, open books for an open world
Jump to: navigation, search
Navbar for the Aros wikibook
Aros User Docs
Aros User Docs
Aros User FAQs
Aros User Applications
Aros User DOS Shell
Aros/User/AmigaLegacy
Aros Dev Docs
Aros Developer Docs
Porting Software from AmigaOS/SDL
For Zune Beginners
Zune .MUI Classes
For SDL Beginners
Aros Developer BuildSystem
Specific platforms
68k Support
PPC Power Architecture Support
Arm Raspberry Pi Support
Android support
Linux and FreeBSD Support
Windows Mingw and MacOSX Support
Aros x86 Installing
Aros x86 Audio/Video Support
Aros x86 Network Support
Aros x86 Complete System HCL
Aros Storage Support IDE SATA etc
Aros Poseidon USB Support
x86-64 Support
misc
Aros Public License


Contents

Introduction[edit]

Zune classes are identified by the trailing .mui


Family.mui Application.mui Window.mui Area.mui
Menustrip Aboutmui Rectangle
Menu Balance
Menulist Image
Menubar
Bitmap
Text
Gadget
Gauge
Scale
Colorfield
List
Numeric
Pendisplay
Group


MUIBuilder[edit]

MUI-Builder allows you to create the complete interface of an application. For example, all the windows of this application were created with MUI-Builder.

Each application is made up of a hierarchy of interface objects. As an example, the following diagram depicts a possible application.

Application -> One or more Windows -> One or More Objects (maybe in groups) 

MUI-Builder is aimed at letting you create this tree simply by using a simple user-friendly graphic interface. We will build step by step a little GUI, whose goal will be to display a simple text when we click on some buttons.


MUIBuilder -> MIUB generic text file -> View to test GUI -> Object Code -> create Guide Docs 



Simple GUI layout[edit]

MUIBuilder 2.3 application has a Windows and a Creation Control section.

First of all we have to create a window by click on New Window under Creation Control headings which opens Windows Attributes window which has a Creation Control TAB and Attributes TAB.

Add Child button from the middle section.

Select in Object Choice (ie a list of GUI objects) and click on the Text option button (it is near the bottom).

Usually would define its parameters (you don't need to modify anything at this time) and click on Ok.

We will in future set more options within Windows and Buttons, e.g. Labels, etc.

Your Text object is now inserted under GROUP_ROOT as G TX_label_0.

Now add a group via Object Choice again (make it an horizontal group by ticking Horizontal Group in Attributes TAB).

If everything goes well, you'll see the group name just under the text object e.g. H GR_grp_0

select this group, and add three buttons (select GR_grp_0 each time and Add Child and KeyButton). Just define their Title(s) '1st button', '2nd button' and '3rd button' and their shortcuts '1', '2' and '3'.

Your simple GUI is now completed ! Now we will define the notifications on these objects.


Select the 1st button in Windows Attributes, and click on the Notify button at the bottom of the MUIBuilder window.

In the window which appears, choose the Release button event, then choose the text object you previously created (TX_label_0), and at last the Put a constant value action. Add this notification simply by double-clicking on the action name, or click on the Add notify. MUIBuilder will ask for a string for you to enter. Enter '1st button selected'. Once added, quit the notification window.

Repeat the previous operation on the two other buttons : enter '2nd button selected' and '3rd button selected' as constant strings.


View Button

Once you've returned to the creation window, just press the Test button, and click on the buttons of your GUI.


The Project menu SAVE and LOAD will respectively save to and load from a file (#?.MUIB) the interface of the application you're creating. Using these buttons, you can continue with a previously unfinished application, or modify an already existing application. The save file is an ascii file, so it is easy to edit it using a text editor. Please don't modify them in this way : there is a good chance that you will corrupt the file ...



Very simple Calculator type layout[edit]

Repeat the start of the above example until after the text object is added.

Click on GROUP ROOT (GR_grp_0) rather that TX_Label and click on Add Child and select Group object (the top option)

This automatically opens a Group Choices window for new GR_grp_1.

Tick boxes Horizontal Group, Same Size, Columns and Horizontal Spacing. Set Row/Columns Number to 5 and Spacing Horizontal to 3. Click OK

Now click once this newly added option and click Add Child again and select Keybutton to add, repeat four more times

Single click on GR_grp_1 and Copy -> button to copy the group (with buttons) to tmp windows (right hand side)

Single click on the top entry in the tmp window (e.g. GR_grp_1). Click on <-Copy button four times to copy back

Clicking Test (center of three buttons at the bottom), you should now have a text window spanning the whole width and 25 buttons (5x5) underneath.



Dual directory lister type layout[edit]

(when viewing results it adds objects underneath rather than besides) and



Code Button

When you click on the 'Code' button of the MUI-Builder main window, you start the generation of the source code.

MUI-Builder will verify that you haven't used the same label for two different objects twice. There are two lists (side by side) in the Code TAB

  • one containing the names of all objects in you application (Objects Label list)
  • one containing the names of all labels that will be generated in your source code. (Generated Labels list)

You will be able to control very precisely the way MUI-Builder will generate the labels in your code. If you don't care about this option, MUI-Builder will do everything automatically for you!


Before generating the source code, you will have to define the options in the Options TAB. The software actually creates generic code, which is more a description of the program than a real compilable source.

After this generic code is created ( temporary file in 'T:' ), MUIBuilder executes one of the code-generation modules ( located in the 'modules' directory ) which uses the temporary file. Actually most languages are available.

  • Declarations : to obtain the declarations and initializations in your source
  • Environment : select it if you want to generate code for includes, event loop, procedure declaration ...
  • Code : select it if you want to generate the MUI code.
  • Generate IDs :
  • Notifications : to generate notifications source code.
  • Locale : to generate localize code.


Locale Tick Box in Options TAB

When you select the Locale box in the Code window and Options TAB, you chose to generate localized source code. In fact, all strings and shortcuts will be replaced by a call to a 'GetString' function ( which should return a locale string from your catalog file ).

A lot of program are able to generate this function for you (Catcomp and Flexcat for examples ). The name of the 'GetString' function can be chosen either in the preferences window, or in the code-generation window. If you don't know how to use these features, please take a look at the examples included in the MUIBuilder archive.


Note that each option may be selected independently from the others. You can also create exactly the part of the code you desire ...

Example:

You've created a window and you want to add a button in your code. Select only the 'Code' option and create it will create the button code! After inserting this text in the program, you'll need the declaration of the object button in your source. Select 'Declaration' ... and insert the generated text directly where you want in your source !


Code Button
App Code Button

This button enables you to generate the source code for the whole application. The generated source will depend on the options you previously choose.


Object Code Button

This button enables you to generate the source code of an object you previously chose in the 'Objects labels' list. This operation can really be of interest, if you want to be able to create stand-alone MUI objects : for example, you could be able to generate each window independantly, or include an object in more than one window by calling the function creating this object.

By selecting this button, you can deactivate the code generation for the object selected in the 'Generated Labels' list.

MUI-Builder automatically knows if it has to generate the label of each object. For example it is often useless to keep a pointer variable to a MUI-Group, unless you want to dynamically add objects to this group during the execution of the program.

Remove Label and the Add label button allow you to change MUI-Builder standard definitions on objects.


By clicking on this button, you tell MUI-Builder to generate the label of the selected object.


Catalog Button

The name of the '.cd' file must be given before generating the Catalog.

Here is a summarize of what is necessary to know about the catalog description file ( 'xxxx.cd' file )

You'll find in this file all the strings of your program in the default language.

Thanks to that file, you will be able to create automatically ( with Catcomp or Flexcat ) :

the translation file ( 'xxxxx.ct' file ) in which you'll find the strings in a foreign language.

the program source file corresponding to your favorite language.

To all beginners who still don't know how to localize a program, i suggest to use the now well-known Flexcat program (by Jochen Wiedmann) which will provide you the possibiliy to generate code in most languages.



Objects[edit]

MUIBuilder enables you to create every MUI objects that you would like to include in you application. These objects can be created or modified in the main creation window (after you pressed the New Window button in the main window).

To line up some objects, you just have to include them in a multi column (vertical lining) or a multi-lines (horizontal lining) group (most of the time multi column)

Some objects (Slider, CheckMark, String) have a title proposed by MUIBuilder. These titles don't exist in MUI: to give you this possibility, MUIBuilder include the object and its title in an horizontal group. So you won't be able to line up these objects, if you use this feature : just use some labels + objects without title in some multicolumn groups.

One of the frequently asked questions is : "after i added some objects in my window, the GUI is no longer resizable" : only one answer to give : use Space objects and add them in your GUI !


Group (groups other GUI elements)[edit]

Groups are the basics elements to which all other objects will be placed. Every time you create an object you will have to declare it as a child of a specific group. You may specify this group by selecting it in the list gadget.

When you create a new window, it already has a group default child. This child object is the root group. You define a window by attaching children to this root group. Note that other groups may also be children to the root group. You must define the attributes for each group:

  • Horizontal : The objects of the group will be placed horizontally.
  • Register : The group will show only one of its children at a time. After selecting this attribute, you must go to the 'Register' entries page to chose the names of the pages of the register.
  • Same Height : The all chidlren of the group will have the same height.
  • Same Width : The all children of the group will have the same width.
  • Same Size : The all children of the group will have the same size.
  • Virtual : The group will be virtual.
  • Columns : Format the group in columns. Enter the number of columns in the string gadget.
  • Lines : Format the group in rows. Enter the number of rows in the string gadget.
  • Spacing
Horizontal 
enables you to control horizontal spacing between the objects.
Vertical 
enables you to control vertical spacing between the objects. This object inherits from the Area object.

To get children there's MUIA_Group_ChildList. Walking through list is done with NextObject().

To get parent there's MUIA_Parent.

If you don't know number of children or it's variable you would have to alloc some memory for the method struct ( sizeof(struct MUIP_Group_Sort) + sizeof(Object *) * num_children) and then call it with DoMethodA(obj, alloced_method). Then free the method struct again.

num_children = number of successful NextObject() calls on child list.



Application (main class for all applications)[edit]

MUIA_Application_Sleep. Nesting works, too. Blocks all input handling in the window. Including resizing (since it requires input handling.) setting it to FALSE brings things back works.

Your application is the root node of the dependency tree representing your complete graphic interface. By clicking the 'Apply' button in the main window of MUI-Builder, you can set:

  • Base of the application i.e. the name of the AREXX server of your application
  • Author the author's name
  • Title the application's name
  • Version the version
  • Copyright the copyright text
  • Description a description of your application

Moreover, you'll find in this window other buttons at the bottom :

Notify The possibility to add notifications on the application. It can have only one sort of child object
the Window.
Menu button, that will open the menu creation window, that will enable you to create the application Menu. This menu can't be tested from MUIBuilder, since it must be attached to an application ! And i can't create a new application in the MUIBuilder application itself !!!!



Window (main class for all windows)[edit]

You all already know what a window is! But the problem is learning how to make one with MUI-Builder...

After clicking New Window button, the Window Attributes window has two TABS, one named 'Creation Control' and the other called 'Attributes'.

The Creation page contains 2 lists
  • In the fist one, you build your GUI itself. The display offers a hierarchical tree. To fold or unfold a node of the tree, you just have to double-click on the little arrow at the left of the object. Thanks to the buttons between the two lists, you can edit/copy/move the objects of your GUI. Moreover, the menus offer two items Fold and Unfold which will enable you to fold or unfold completely the whole tree.
  • In the two most left columns appear two letters : H(for Help) and G(for generated) : they enable the control respectively from the node generation in the guide documenation, and for the label generation in the source code. If you double-click on one of this letter, it toggles the generation either of the AmigaGuide node, or of the label in the source.

The goal of the right-most list is to store temporarily some objects.


In the 'Attributes' page, you can find 
Window label and title. The window attributes themselves :
  • AppWindow : if you want your window to be a appwindow
  • Borderless : if you don't want a border
  • Depth gagdet : if you want a depth gadget
  • Size gadget : if you want a size gadget
  • BackDrop : to have a window in the background
  • Close gadget : to put a close gadget in the window
  • Dragbar : enables the window to be dragged
  • Open at Init : (IMPORTANT) this specify if you want your window to be opened when your application will be created.

Busy window pointer uses MUIA_Window_Sleep set it to TRUE:



Area (base class for all GUI elements)[edit]

Every MUI objects that inherits from the Area object include in their GUI a register group.

Hide : The object won't appear in the GUI, except if it is alone in the window.

Disable : the object gets a ghost pattern and doesn't respond to user input.

Input Mode : enable to turn an object to a button.

Phantom Frame : The frame will not appear.

Frame : Defines a frame for the current object.

Background : Defines the background you want in your object.

Control char : the character needed to activate a given object.

Title Frame : a title added in the top of the frame of the object

Some attributes are not provided for some object : this is not a bug ... it's a feature !!! I don't want the user to be able to do something wrong in his GUI (such as making a button with a String frame !!!!).


Rectangle (spacing object)[edit]

This object is little bit complex, because it offers in fact more than only one object. It enables the creation of :

  • A rectangle area in a window
  • A horizontal bar, with or without a title to separate objects in a GUI
  • A vertical bar to separate objects in a GUI

You can define the height and width of these objects too.


This object inherits from the Area object.


Balance (balancing separator bar)[edit]

?

Image (image display)[edit]

To define an image for this gadget, you must select the image that you wish to be displayed.


Possible choices are :

Free Vertical : the image will resize vertically.

Free Horizontal : the image will resize horizontally.

Input Mode : the user will be able to select the image.

Fix Height : set the image height to a constant specified in the associated string gadget. This makes Free horizontal useless.

Fix Width : set the image width to a constant specified in the associated string gadget. This makes Free vertical useless.

As with other objects, you must specify the label.

Two notes about the image support in this version 2.2 :

the popasl gadget provide the ability to enter an image file (which will be displayed using datatypes)

It seems there is a problem with dynamically added images in MUI : they seem to not be displayed right. So, when you'll test your application, sometimes the image won't appear. Despite of this, the code should be correctly generated.

This object inherits from the Area object.


Menubar (displays a menustrip object)[edit]

Bitmap (draws bitmaps)[edit]

Bodychunk (makes bitmap from ILBM body chunk)[edit]

Text (text display)[edit]

To define a Text Gadget, you must specify :

Text_SetMax : the maximum size of the gadget will be its initial size.

Text_SetMin : the minimum size of the gadget will be its initial size.

Label : Its label in the generated source code


The text must be written in the associated string gadget and can contain every Special character you can find in a C source code.


This object inherits from the Area object.

changed all simplebutton with textobjects (and controlchar) so everyone now can use a num pad!:D

TextObject,
    ButtonFrame,
    MUIA_Font, MUIV_Font_Button,
    MUIA_Text_HiCharIdx, '_',
    MUIA_Text_Contents, text,
    MUIA_Text_PreParse, "33c",
    MUIA_InputMode    , MUIV_InputMode_RelVerify,
    MUIA_Background   , MUII_ButtonBack,
    MUIA_CycleChain,    1,
End 



Gadget (base class for intuition gadgets)[edit]

String (string gadget)[edit]

Set the string edit-box active. Set the the OK button as default with MUIA_Window_DefaultObject.

(see WBRename tool)

--- a/workbench/system/Wanderer/Tools/WBNewDrawer/main.c
+++ b/workbench/system/Wanderer/Tools/WBNewDrawer/main.c
@@ -25,7 +25,7 @@
 #include <stdio.h>
 #include <string.h>
 
-char versionstring[] = "$VER: WBNewDrawer 0.6 (09.03.2010) ©2010 AROS Dev Team";
+char versionstring[] = "$VER: WBNewDrawer 0.7 (06.04.2011) ©2011 AROS Dev Team";
 
 static STRPTR AllocateNameFromLock(BPTR lock);
 static void bt_ok_hook_function(void);
@@ -138,7 +138,7 @@ static void MakeGUI(void)
     set(str_name, MUIA_CycleChain, 1);
     set(window, MUIA_Window_Open, TRUE);
     set(window, MUIA_Window_ActiveObject, str_name);
-    set(window, MUIA_Window_DefaultObject, str_name);
+    set(window, MUIA_Window_DefaultObject, bt_ok);
     DoMethod(app, MUIM_Application_Execute);
 }


Boopsi (interface to BOOPSI gadgets)[edit]

?


Prop (proportional gadget)[edit]

Set the following options :

Horizontal : the gadget must be horizontal

Fix Width : set the width to a constant specified in the associated string gadget.

Fix Height : set the height to a constant specified in the associated string gadget.


Then you should specify :

the number of entries

the number of the first entry

the number of visible entries

As always : don't forget the label !


This object inherits from the Area object.


Gauge (fuel gauge)[edit]

To define a gauge, you must set:

its orientation ( horizontal or vertical)

if you want to set the height of the gauge to a constant value it must be specified in the associated String Gadget. This is especially useful with horizontal gauges.

if you want to set the width of the gauge to a constant value it must be specified in the associated String Gadget. This is especially used with vertical gauges.

if its value must be 'divided' (then give the associated value)

its maximum value

the info test of the gauge : this little text will be displayed inside the gauge itself. To include in this text the current level of the gauge, just put a %ld in the info text.

its label


This object inherits from the Area object.


Space[edit]

This object allows you to insert a space between two other objects so the window can be resized. It can be horizontal, vertical or vertical and horizontal. You can enter the spacing value for both the horizontal and vertical space.


Scale (percentage scale)[edit]

A scale gadget must be used with a Gauge gadget to display a graduation beside it.

You only have to specify its orientation. Note that only the horizontal orientation is available at this time in MUI.


This object inherits from the Area object.



Colorfield (field with changeable color)[edit]

This simple object is designed to show a colour on screen. You just have to define :

If you want to fix its height or not

If you want to fix its width or not

the colour of the field


This object inherits from the Area object.



List[edit]

To completely define a list, you must specify :

its label

if 'double click' is enable or not

if the multiselection is enable

if the list is in input mode or not

if the vertical size must be adjusted at creation or not

if the horizontal size must be adjusted at creation or not

The part of the list you want to show to user (activate): - No special positioning - Show the first entry - Show the last entry


the type of the list - a standard list

  • a floattext list, that allows to show texts. You can enter a text in the corresponding string gadget
  • a list of volumes ( volumes + assigns )


The function hooks can be defined too, but they are not absolutely necessary to make the list usable (see MUI-Autodocs!)

  • Construction : called when you insert an object in the list
  • Destruction : called when you delete an object in the list
  • Compare : called when you sort the list
  • Display : called when you display an object
  • Multitest : called when you perform multiselection


The format of the list enables to define multicolumn lists (not tested directly in MUIBuilder).

The list title. Note that there is an other type of list called a DirList. This type of list can be created by clicking on its button in the 'Object Choice' window. This object inherits from the Area object.


DirList[edit]

The Directory list shows the files and directories in the selected directory. The possible options are :

Drawers only : shows ONLY directories

File Only : shows ONLY files

MultiSelection : enables a multiselection of the files in the list

Reject Icons : don't show the '.info' files

Sort High-Low : reverse sorting order

Sort Type : choice of the sort key ( Name, Date, Size )

Sort Dirs : Three possibilities :

  • Directories appear at the head of the list
  • Directories appear at the tail of the list
  • Directories are mixed with file (following Sort Type option)

The directory to read

The pattern to accept

The pattern to reject

This object inherits from the Area object.


Temporary List[edit]

In this list you can put objects you want to move from a group to another one, or from a window to another one. The list content won't be deleted when you delete your application, or when you load a new one. In this way, you will be able to transfer an object from an application to another one ...


Floattext (special list with floating text)[edit]

Volumelist (special list with volumes)[edit]

Scrmodelist (special list with screen modes)[edit]

String[edit]

To completely define a string gadget, you must specify :

its title ( that you can replace with your own )

its label

the initial content of the string gadget

a string containing all the letters accepted by the gadget

a string containing all the letters refused by the gadget

the maximal length of the string


This object inherits from the Area object.


Button[edit]

To completely define a button, you must specify:

its label

the text that will appear in it


This object inherits from the Area object.


Label[edit]

To completely define a label gadget, you must specify :

its label

the text that appears on screen


This object inherits from the Area object.


Cycle Gadget[edit]

To completely define a cycle gadget, you must specify :

the list of its entries

its label


If you specify a control char for a cycle gadget, please add a label with the same control char, so that the user could see which character he has to use !

This object inherits from the Area object.


Radio Buttons[edit]

To completely define a radio gadget, you must specify :

the buttons' list : to add, delete, rename the entries of this list, just use the buttons at the right of the list.

its label


This object inherits from the Area object.

it other amigaoses mui gives nice two rows ( MUIA_Group_Columns, 3, in my code )

MUIA_Group_Child, data->settings[RESOLUTION_RADIO] = NewObject(MyRadioClass->mcc_Class, NULL,
MUIA_Radio_Entries, Radio_DPI,
MUIA_Group_Columns, 3,
MUIA_Radio_Active, 2,
TAG_END),

but on Aros i have one row :/

I added MUIA_ShowSelState, FALSE, into this code because on morphos backdrop was selected and change state. It may be ZUNE bug too and maybe should be fixed in ZUNE sources :).

IPTR muiscanMyRadio_New(struct IClass *cl, Object *obj, struct opSet *msg)

for (i = 0; i < entries_num; i++)
{
state = (entries_active == i) ? TRUE : FALSE;

buttons[i] = HGroup,
MUIA_ShowSelState, FALSE,
Child, (IPTR)ImageObject,

Try adding another invisible object (Child, HVSpace) to the group so that the number of objects in the group is evenly dividable by the number of rows. MUI autodocs say that is how it is supposed to be done, but maybe newer versions of it don't mind anymore.


Register (handles page groups with titles)[edit]

Penadjust (group to adjust a pen)[edit]

Virtgroup (handles virtual groups)[edit]

Scrollgroup (virtual groups with scrollbars)[edit]

Scrollbar (traditional scrollbar)[edit]

Listview (listview)[edit]

CheckMark[edit]

You can specify wether you want a Title or not (like the strings and sliders) before the CheckMark. If you want a title, you can specify it in the 'title' string gadget Don't forget to specify a label.


This object inherits from the Area object.



Numeric (base class for slider gadgets)[edit]

Knob (turning knob)[edit]

Levelmeter (level display)[edit]

Numericbutton (space saving popup slider)[edit]

Slider (traditional slider)[edit]

You can specify:

if the current level must be displayed ( 'Slider Quiet' )

if the slider must be displayed in the reverse mode

if the slider must have a title or not

Then you must specify:

the maximum value

the minimum value

the initial value


You can also set:

the title of the object

and its label !


This object inherits from the Area object.




Popstring (base class for popup objects)[edit]

Popobject (popup anything in a separate window)[edit]

The Popobject provides a list and an image associated with any of the MUI object you can create with MUIBuilder. This object will pop up when you'll click on the popup image. It will appear in the tree hierarchy display as any other object of the GUI, and can be edited in the usual way ... even if it is a group which contains many other objects.

To define this object, MUIBuilder provides :

A list with the possible images

Some attributes :

  • Follow : The Pop object follows the window
  • Light : The Pop Object is displayed in a borderless window
  • Volatile  : The object disappear when you click on the pop image


The hooks provided here are :

  • Open Hook  : called at the opening of the pop window
  • Close Hook : called at the close of the pop window

The label of the object


This object inherits from the Area object.


Poplist (popup a simple listview)[edit]

Popscreen (popup a list of public screens)[edit]

Popasl[edit]

This object enables the inclusion of standard ASL requesters in your GUI. The attributes you can set are:

The image you prefer

The type of the requester which could be :

  • File requester
  • Font requester
  • Screen Mode requester

There are some hooks you can set:

  • Start hook : called at the requester creation
  • Stop hook  : called when you close the requester

the label of the requester

This object inherits from the Area object.



Coloradjust (several gadgets to adjust a color)[edit]

Palette (complete palette gadget)[edit]

Pendisplay (displays a pen specification)[edit]

Poppen (popup button to adjust a pen spec)[edit]

Family (handles multiple children)[edit]

Menus[edit]

A menu can be attached to a window or the application object. It is made of several titles, sub menus and items. When built, it is similar to a tree hierarchy, and is displayed in this way in the menu creation window.

The only limitation is the depth of the tree which is limited to 2. (In fact : a sub menu can't have a sub menu)

Moreover:

The titles, submenus and items can be activated or not using the Enable checkmark

The items have acces to some more attributes :

  • It can be Checkable
  • If checkable, you can set its initial state
  • You can define a shortcut for any menu item



Notifications[edit]

The events notifications is to my mind the best new feature provided in MUIBuilder 2.0. It's the first time in the amiga history :-) that such a feature is included in an interface builder.

The goal is to provide the possibility to define links between events and actions. The events come from MUI Object : you will define for a given event the action that will be performed, and on which object it will be performed.

Once a link event-action is builded, it can be tested directly by MUIBuilder, by clicking on the Test button on the creation window. Every action which don't use the application object or/and external program variables can be tested without any problem in MUIBuilder.

The notification window offers :

The list of the possible events generated by the object whose name appears at the top of the window

The list of the objects on which an action can be performed. To help you to find a given object, the list entries are organized in a hierarchical order. The window containing the object you are editing appears at first position in this list, then comes the application object, and at least all other windows in the application.

Once you have selected a destination object, the third list contains all actions which can be performed on this object. Some of these actions need some arguments ... MUIBuilder will ask for them if needed.

To add a notification on an object you are currently editing, you need either to double-click on an element of the actions list, or to select the Add Notify button.

The application object collects all actions to make on your program itself (for example external variables modifications, functions call ...)

When you validate an action, it is possible that it needs a parameter : if so the program will open a request window. The parameter can be of the following types :

  • Functions - Choice of a function name.
  • Variables - Choice of a variable name.
  • Constants - Give a constant.

The choice of an object to which you want to add a notification can be performed in two different ways :

  • For a window : by clicking on the Notify button of the Attributes page
  • For an object: by selecting the given object in the creation window and clicking on the Notify button.


Functions[edit]

If an action parameter is a function Hook, MUIBuilder ask you for the function name. It opens a window where all the existing functions appear. You can either chose one of the existing functions or create a new one. When you generate the source code, MUIBuilder will generate what is needed to reference these functions.


Variables[edit]

Some actions need a variable as parameter. To get this variable name, MUIBuilder opens a window, in which you can find the list of existing variables. You can either chose one of the existing function or create a new one.


Constants[edit]

A constant can have several types:

  • A boolean : 2 possibles values True/False
  • A string
  • An integer
  • A character

Depending on the type of the constant, one of the gadgets of the request window will be activated. You'll have to enter the needed value in this gadget.



MUIBuilder Preferences[edit]

This configuration Panel offers many choices for parameters for the program. All choices will be saved in an environment variable (ENV:MUIBuider.env) which is creating when you are installing MUIB.

There are the following choices :

1. Ghost windows : to see ONLY one window of MUIBuilder at a time. (very useful for slow computers, and for people who dislike having too many windows on the screen ! )

2. Icons : select it if you want an icon created with the save file

3. Requests : select it if you want all the warning requesters

4. Test : if you select this option, you will see the result for your work during the building you your GUI.

5. Code : chose your generator module

6. Editor : You must specify here the name of your favorite editor. This editor should be run in a synchronous way ! ( i.e. not as a background task ). the following editors should work without any problems :

7. GetString : If you enter a string here, it will be the default name of the 'GetString' function which is used to localize your program. If this String is EMPTY, then MUIBuilder will create a name using the application name ( 'GetApplicationNameString' ).

8. Depth : allows you to define the minimal depth used when displaying the tree hierarchy in the creation window.

9. Character : this character is inserted in the tree display to make hierarchy more readable.

10. Label : if you set this option, the names of the objects will appear to make the hotkay visible.

11. Columns : number of columns used to display the image objects.

12. Images Location : The directory where you can find the objects images.


Once you have selected these options, you can save them by selecting the corresponding button. When you save the preferences, it saves your working directory too (in the environment variable of course).




Misc[edit]

why does Zune use such weird get() macros? e.g.

#define get(obj, attr, storage)                                         \
({                                                                      \
    union {                                                             \
       IPTR  __zune_get_storage;                                        \
       typeof(*storage) __zune_val_storage;                             \
    } __tmp;                                                              \
    __tmp.__zune_val_storage = *storage;                                  \
    ULONG __zune_get_ret = GetAttr((attr), (obj), &__tmp.__zune_get_storage); \
    *(storage) = __tmp.__zune_val_storage;                                \
    __zune_get_ret;                                                     \
})

Why is it not simply:

#define get(obj,attr,store) GetAttr(attr,obj,(IPTR *)store)

??

The problem with the first macro is that it accesses the contents of the pointer and thus code like

int x; get(listview, MUIA_NList_Active, &x);

raises tons of "variable 'x' is used uninitialized in this function" warnings because the macro reads from the pointer... but it shouldn't do that because it doesn't matter what's inside "x" when calling get().

I believe the reason is the strict aliasing "problem" with recent GCC versions. (at least that's what I remember). I think the idea was to have code like this

   ULONG var;
   get(obj, attr, &var);

working on 64 bit AROS without "ULONG --> IPTR" source code changes. But I don't think it would work on big endian 64 bit cpus.

It's still pretty awkward because it even breaks some code. E.g. the following doesn't work with the new get() macro:

ULONG *rgb;
get(obj, MUIA_XXX_Picture, (ULONG) &rgb);

The ULONG cast causes an error here from gcc. I have to remove it in order to get it built or switch to the old macros. Very annoying...



Is there a way to make the sub-window that Network Prefs uses for entering interface details bigger? I've now added a second window like this for specifying wireless networks, and the problem is even worse because the box for entering the encryption key is tiny. I've tried and failed to specify a bigger size or add a resize gadget with MUI tags. Is this a bug in the program or in Zune?

This happens because of the rules MUI/Zune uses to calc min/max sizes. From MUIdev.guide:

  • Vertical groups - The minimum height of a vertical group is the sum of all minimum heights of its children. The maximum height of a vertical group is the sum of all maximum heights of its children. The minimum width of a vertical group is the biggest minimum width of its children.

The maximum width of a vertical group is the smallest maximum width of its children.

So if you have a vertical group with one ore more (horizontally) resizable objects and additionally one or more objects which has a fixed width, then the group will get a fixed maxwidth, i.e. not resizable.

So make sure that all child objects of the vgroup are resizable horizontally:

Index: netpeditor.c
===================================================================
--- netpeditor.c        (revision 35370)
+++ netpeditor.c        (working copy)
@@ -373,11 +373,15 @@
         MUIA_Window_CloseGadget, FALSE,
         WindowContents, VGroup,
             GroupFrame,
-            Child, ImageObject,
-                MUIA_Image_Spec, (IPTR)"3:Images:interface",
-                MUIA_FixWidth, 52,
-                MUIA_FixHeight, 48,
-            End,
+           Child, HGroup,
+               Child, (IPTR)HVSpace,
+               Child, ImageObject,
+                    MUIA_Image_Spec, (IPTR)"3:Images:interface",
+                    MUIA_FixWidth, 52,
+                    MUIA_FixHeight, 48,
+               End,
+               Child, (IPTR)HVSpace,
+           End,
             Child, (IPTR)ColGroup(2),
                 GroupFrame,
                 Child, (IPTR)Label2(_(MSG_IFNAME)),


And when you add

  1. define MUIMASTER_YES_INLINE_STDARG

at the beginning of your program you don't need the additional argument in MUI_Request.


IMHO It would be better to study the real behaviour of the MUI classes in question to find out what should be happening and why/how we differ - and fix Zune appropriately.

The difference between MUI and zune is, that MUI push all redraw messages and redraw later when pop the messages all at once and avoid double redraw. AROS redraw immediate. The problem of change AROS to do the same is what should do if a redraw is push and the class is remove. The object would know about the pushed redraw and should remove it on its own deletion.


Morphos has some details on subclassing.


Seems to be MUI dataspace "design problem", config data is stored and loaded as a stream of bytes, original type is unknown at this point. muimaster/classes/dataspace.c and notify.c For example BetterString on the other hand stores all config data as strings.



In zune prefs select NListTree, select Example tab, then select any other class -> crash.

That's probably still this long standing bug. Georg made some suggestions, but I was uable to implement them.

I have a solution for the problem. It needs a new attribute MUIA_Group_InExchange. In MUIM_Group_InitChange we check if there is a parent and if this one or one of its parents is in exchange state. If so, we do not set the exchange state flag, because recalc display will be done by one of the parents of the object. If not, we set the exchange state flag for the current object and recalc display will happen on MUIM_Group_ExitChange. I'm absolute noob when it comes to mui coding, but usually it's good practice in OOP to handle something completely inside of one class.

Init/Exit Change might help you.

If you change a GUI element, call on the parent group first and after your modifications call MUIM_Group_ExitChange.

You can also just force a refresh without anything between init and exit: DoMethod(groupobj, MUIM_Group_InitChange); DoMethod(groupobj, MUIM_Group_ExitChange);

Exactly .. Zune is designed to automatically position/size the objects. Because of this you have to tell the parent object that wou are going to alter yourself, and at the end it should also cause the other "children" to adjust themselves accordingly. Thats the whole purpose of having to do the initchange/exitchange stuff.

Zune will make the affected objects re-layout, and then fire the draw method to make them visibly update.

You are _never_ meant to draw outside of the draw method.

Reference[edit]

See Zune reference at Aros/Developer/Zune