Zamae

The Prosciutto Project

a small footprint mobile application engine and browser - and open source!

TEMPLATES:

Templates are nothing but a collection of buttons that have a specific anchor. They are useful when you have a group of buttons that are repeated accross several forms, for example a "back" button you might want to implement everywhere in the bottom of each form. You'd just place it in a template and make that template be indicated by each form that needs to use such a template.
Templates are always defined as part of the "template_group" independent element.

The only mandatory field is the "uid" attribute. The first template button UID MUST match that of the template group.

Please note also that Prosciutto's default cache memory is up to 8 buttons per template (and up to 10 templates in memory at a time only). This can be modified by either using the config tag in model.xml, or by placing the values you need in the za_UI_api.initialize() call in the class of your own that extends the za_UI_api class.

    <template_group uid="12980" >
        <template uid="12980">
            <appearance>
                <focusable>yes</focusable>                              //Possible values are "yes" or "no". Default value if not declared is "yes".                                                                                              
                <anchor>bottom</anchor>                                 //Possible values "top" or "bottom" or "null"--> "top".                                                                                                                   
                <editable>no</editable>                                 //"yes" or "no". Default to "no". Editable buttons mean the text is editable by the user by pressing FIRE onits focus.                                                    
                <x_coord>-1</x_coord>                                   //The left coordinate. Any positive integer between 0 and the screen width. "-1", "undef" or "undefined" is the default and means the zero position at left.              
                <y_coord>-1</y_coord>                                   //The upper coordinate. Any positive integer between 0 and the screen height. "-1", "undef" or "undefined" is the default and means the zero position at left.            
                <color_id>69002</color_id>                              //The UID for the color definition element that describes this button color.                                                                                              
                <bkgimg_id img_alignment="hcentered">-1</bkgimg_id>     //The background image array that will be displayed inside this button. "-1", "undef", or "undefined" for no images (default).                                            
                <height>-1</height>                                     //Height of button. "undefined" is the default value and ZAMAE will calculate the height based on fonts, bkg images and text.                                             
                <width>-1</width>                                       //Width of button. "undefined" is the default, ZAMAE will make the button as wide as possible as per the form width.                                                      
                <btn_alignment>hcentered</btn_alignment>                //Button alignment. Can be "absolute" only if x_coord and y_coord are specified. Otherwise, "undef", "left", "right".                                                     
                <font_unfocused>91001</font_unfocused>                  //font definition to use when the button is unfocused.                                                                                                                    
                <rgb_text_unfocused>cccccc</rgb_text_unfocused>         //color in RGB (hex) to use for the text when the button is unfocused.                                                                                                    
                <font_focused>91002</font_focused>                      //font definition to use when the button is focused.                                                                                                                      
                <rgb_text_focused>000000</rgb_text_focused>             //color in RGB (hex) to use for the text when the button is focused.                                                                                                      
                <text txt_alignment="hcentered" txt_fx="scroll">EXIT</text>         //actual text to be shown in this button                                                                                                                      
                <img_onfocus_id img_onfocus_alignment="left" >83001</img_onfocus_id>//the image array to be shown when this button is focused. This image array is printed as the last thing. (first background, then text, then image on focus). 
                <visualfx_onshow>none</visualfx_onshow>                 //visual effect when this button gains focus. "fadein", "fadeout", "movesmooth".              
                <visualfx_onhide>none</visualfx_onhide>                 //visual effect when this button loses focus. "fadein", "fadeout", "movesmooth".              
                <visualfx_smoothness>1</visualfx_smoothness>            //how fast should the visual effect display changes. Measures in milliseconds.                
            </appearance>
            <behavior>
                <action_fire fire_param="null">exitapp</action_fire>    //action when FIRE is hit and this form element has the focus.                                                                        
                <action_up up_param="null">default</action_up>          //action if UP key pressed when focused                                                                                               
                <action_down down_param="null">default</action_down>    //action if DOWN key pressed when focused                                                                                             
                <action_left left_param="null">default</action_left>    //action if LEFT key pressed when focused                                                                                             
                <action_right right_param="null">default</action_right> //action if RIGHT key pressed when focused                                                                                            
                <validator_mask validator_param="-1">-1</validator_mask>//Only usable for editable buttons. Validator masks are good for checking passwords, entered text lengths, etc.                       
                <save_session>no</save_session>                         //saves session, means any OFF FOCUS action on this form collects data from the hidden param of this button among others              
                <hidden_param> </hidden_param>                          //hidden parameter, for server to get back and forth data                                                                             
            </behavior>
        </template>
    </template_group>

For a list of possible actions to define in the behavior section please check the form description.

Back to UI objects listing