MUI Autodocs: Popobject.mui

Copyright © 1997, Stefan Stuntz




Popobject.mui Background

        Popobject class takes a MUI object as parameter uses this one
        as popup. You can e.g. simply create a listview object with
        some entries and the popobject class will create a window
        around it and display it when the user hits the popup button.

        Using this class instead of creating the popup windows yourself
        prevents you from having lots of problems. Think twice before
        deciding to make you own popups!



Popobject.mui Attributes

    Attribute                           Ver ISG Type
    ----------------------------------- --- --- --------------------
    MUIA_Popobject_Follow               V7  ISG BOOL
    MUIA_Popobject_Light                V7  ISG BOOL
    MUIA_Popobject_Object               V7  I.G Object *
    MUIA_Popobject_ObjStrHook           V7  ISG struct Hook *
    MUIA_Popobject_StrObjHook           V7  ISG struct Hook *
    MUIA_Popobject_Volatile             V7  ISG BOOL
    MUIA_Popobject_WindowHook           V9  ISG struct Hook *


MUIA_Popobject_Follow


    NAME
        MUIA_Popobject_Follow -- (V7 ) [ISG], BOOL

    FUNCTION
        Setting this attribute causes the popup window to follow its
        parent window when its moved. Defaults to TRUE.

    SEE ALSO
        MUIA_Popobject_Light, MUIA_Popobject_Volatile.


MUIA_Popobject_Light


    NAME
        MUIA_Popobject_Light -- (V7 ) [ISG], BOOL

    FUNCTION
        This attribute causes the popup window to be border and
        titleless. Defaults to TRUE

    SEE ALSO
        MUIA_Popobject_Follow, MUIA_Popobject_Volatile


MUIA_Popobject_Object


    NAME
        MUIA_Popobject_Object -- (V7 ) [I.G], Object *

    FUNCTION
        Specify the object to pop up. Usually this is a relatively simple
        thing like a single listview, but you can of course use group
        class here and make rather complex popups. As with all other
        MUI classes, the object here gets disposed when the popobject
        is disposed.

    EXAMPLE
        pop = PopobjectObject,
           MUIA_Popstring_String, KeyString(0,60,'n'),
           MUIA_Popstring_Button, PopButton(MUII_PopUp),
           MUIA_Popobject_StrObjHook, &StrObjHook,
           MUIA_Popobject_ObjStrHook, &ObjStrHook,
           MUIA_Popobject_Object, ListviewObject,
              MUIA_Listview_List, ListObject,
                 InputListFrame,
                 MUIA_List_SourceArray, PopNames,
                 End,
              End,
           End;

   SEE ALSO
        MUIA_Popobject_StrObjHook, MUIA_Popobject_ObjStrHook,
        MUIA_Popobject_Light


MUIA_Popobject_ObjStrHook


    NAME
        MUIA_Popobject_ObjStrHook -- (V7 ) [ISG], struct Hook *

    FUNCTION
        When a popup is closed, this hook is called. You can examine
        the state of your MUIA_Popobject_Object and set the contents
        of the string gadget respectively. The hook receives a pointer
        to itself in A0, a pointer to your MUIA_Popobject_Object
        in A2 and a pointer to the embedded string object in A1.

        The hook will only be called when your popup is closed with
        a success value of TRUE. Otherwise, MUI closes the popup
        without taking further actions, just as if had never opened.

        Since MUI doesn't know anything about your MUIA_Popobject_Object,
        it's your task to tell when your popup is finished. You can
        terminate popups at anytime by sending a MUIM_Popstring_Close
        method:

        /* A double click terminates the popping list with a successful 
           return value. */

        DoMethod(plist,MUIM_Notify,MUIA_Listview_DoubleClick,TRUE,
                pop,2,MUIM_Popstring_Close,TRUE);

    EXAMPLE
        SAVEDS ASM VOID ObjStrFunc(REG(a2) Object *list,REG(a1) Object *str)
        {
           char *x;
           DoMethod(list,MUIM_List_GetEntry,MUIV_List_GetEntry_Active,&x);
           set(str,MUIA_String_Contents,x);
        }


MUIA_Popobject_StrObjHook


    NAME
        MUIA_Popobject_StrObjHook -- (V7 ) [ISG], struct Hook *

    FUNCTION
        Before the popup opens, this hook is called. You can use it
        to prepare your MUIA_Popobject_Object according to the
        contents of the string gadget. The hook receives a pointer
        to itself in A0, a pointer to your MUIA_Popobject_Object
        in A2 and a pointer to the embedded string object in A1.

        Return TRUE if you want the popup to appear,
        FALSE otherwise.

    EXAMPLE
        SAVEDS ASM LONG StrObjFunc(REG(a2) Object *list,REG(a1) Object *str)
        {
           char *x,*s;
           int i;

           get(str,MUIA_String_Contents,&s);

           for (i=0;;i++)
           {
              DoMethod(list,MUIM_List_GetEntry,i,&x);
              if (!x)
              {
                 set(list,MUIA_List_Active,MUIV_List_Active_Off);
                 break;
              }
              else if (!stricmp(x,s))
              {
                 set(list,MUIA_List_Active,i);
                 break;
              }
           }
           return(TRUE);
        }

    SEE ALSO
        MUIA_Popobject_ObjStrHook, MUIA_Popobject_Object, 
        MUIA_Popobject_WindowHook


MUIA_Popobject_Volatile


    NAME
        MUIA_Popobject_Volatile -- (V7 ) [ISG], BOOL

    FUNCTION
        Setting this attribute causes the popup window to disappear when the
        corresponding popobject disappears, e.g. because its in a page group
        and the user toggled the page. When the popobject appears again,
        the popup window appears also. Defaults to TRUE.

    SEE ALSO
        MUIA_Popobject_Light, MUIA_Popobject_Follow


MUIA_Popobject_WindowHook


    NAME
        MUIA_Popobject_WindowHook -- (V9 ) [ISG], struct Hook *

    FUNCTION
        If specified, this hook is called immediately after the
        popups window objects has been created but before this
        window is opened. You might e.g. want to add a cycle
        chain for the popup window here.

        The hook is called with a pointer to the pop object
        (MUIA_Popobject_Object) in A2 and with a pointer
        to the window object that MUI generated to
        handle the popup in A1.

    EXAMPLE
        /* pop is a simple listview, just set the windows
        ** default object to this to enable keyboard control */

        SAVEDS ASM VOID WindowFunc(REG(a2) Object *pop,REG(a1) Object *win)
        {
           set(win,MUIA_Window_DefaultObject,pop);
        }

    SEE ALSO
        MUIA_Popobject_ObjStrHook, MUIA_Popobject_Object





© 1997, Stefan Stuntz [MUI Homepage] [Autodoc Index] [Feedback] Updated: 29-Mar-97