home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / dev / mui-2.1.lha / MUI-2.1 / Developer / Autodocs / MUI_Notify.doc < prev    next >
Encoding:
Text File  |  1994-07-04  |  17.5 KB  |  611 lines

  1. TABLE OF CONTENTS
  2.  
  3. Notify.mui/Notify.mui
  4. Notify.mui/MUIM_CallHook
  5. Notify.mui/MUIM_FindUData
  6. Notify.mui/MUIM_GetUData
  7. Notify.mui/MUIM_KillNotify
  8. Notify.mui/MUIM_MultiSet
  9. Notify.mui/MUIM_Notify
  10. Notify.mui/MUIM_Set
  11. Notify.mui/MUIM_SetAsString
  12. Notify.mui/MUIM_SetUData
  13. Notify.mui/MUIM_WriteLong
  14. Notify.mui/MUIM_WriteString
  15. Notify.mui/MUIA_AppMessage
  16. Notify.mui/MUIA_HelpFile
  17. Notify.mui/MUIA_HelpLine
  18. Notify.mui/MUIA_HelpNode
  19. Notify.mui/MUIA_NoNotify
  20. Notify.mui/MUIA_Revision
  21. Notify.mui/MUIA_UserData
  22. Notify.mui/MUIA_Version
  23. Notify.mui/Notify.mui
  24.  
  25.     Notify class is superclass of all other MUI classes.
  26.     It's main purpose is to handle MUI's notification
  27.     mechanism, but it also contains some other methods
  28.     and attributes useful for every object.
  29. Notify.mui/MUIM_CallHook
  30.  
  31.     NAME
  32.     MUIM_CallHook (V4)
  33.  
  34.     SYNOPSIS
  35.     DoMethod(obj,MUIM_CallHook,struct Hook *Hook, ULONG param1, /* ... */);
  36.  
  37.     FUNCTION
  38.     Call a standard amiga callback hook, defined by a Hook
  39.     structure. Together with MUIM_Notify, you can easily
  40.     bind hooks to buttons, your hook will be called when
  41.     the button is pressed.
  42.  
  43.     The hook will be called with a pointer to the hook
  44.     structure in a0, a pointer to the calling object in a2
  45.     and a pointer to the first parameter in a1.
  46.  
  47.     INPUTS
  48.     Hook       pointer to a struct Hook.
  49.     param1,... zero or more parameters. The hook function will
  50.                receive a pointer to the first parameter in
  51.                register a1.
  52.  
  53.     EXAMPLE
  54.  
  55.     standalone:
  56.  
  57.     DoMethod(obj,MUIM_CallHook,&hookstruct,13,42,"foobar","barfoo");
  58.  
  59.     within a notification statement:
  60.  
  61.     DoMethod(propobj,MUIM_Notify,MUIA_Prop_First,MUIV_EveryTime,
  62.              propobj,3,MUIM_CallHook,&prophook,MUIV_TriggerValue);
  63.  
  64.     prophook will be called every time the knob is moving and gets
  65.     a pointer to the knobs current level in a1.
  66. Notify.mui/MUIM_FindUData
  67.  
  68.     NAME
  69.     MUIM_FindUData (V8)
  70.  
  71.     SYNOPSIS
  72.     DoMethod(obj,MUIM_FindUData,ULONG udata);
  73.  
  74.     FUNCTION
  75.     This method tests if the MUIA_UserData of the object
  76.     contains the given <udata> and returns the object
  77.     pointer in this case.
  78.  
  79.     Altough this sounds not very useful for single objects,
  80.     performing this method on objects that handle children
  81.     can become very handy. In this case, all the children
  82.     (any maybe their children) are tested against <udata>
  83.     and the first matching object is returned.
  84.  
  85.     This method is especially useful if you created your
  86.     menu tree with a NewMenu structure and you want to
  87.     find the object pointer for a single menu item.
  88.  
  89.     INPUTS
  90.     udata - userdata to look for.
  91.  
  92.     RESULT
  93.     A pointer to the first object with the specified user data
  94.     or NULL if no object is found.
  95.  
  96.     NOTES
  97.     If you have many objects in your application, MUIM_FindUData
  98.     may take quite long. You can limit the amount of time
  99.     by performing the method not on the application but on the
  100.     window or even on the group/family your object is place in.
  101.  
  102.     SEE ALSO
  103.     MUIM_GetUData, MUIM_SetUData
  104. Notify.mui/MUIM_GetUData
  105.  
  106.     NAME
  107.     MUIM_GetUData (V8)
  108.  
  109.     SYNOPSIS
  110.     DoMethod(obj,MUIM_GetUData,ULONG udata, ULONG attr, ULONG *storage);
  111.  
  112.    FUNCTION
  113.     This method tests if the MUIA_UserData of the object
  114.     contains the given <udata> and gets <attr> to
  115.     <storage> for itself in this case.
  116.  
  117.     Altough this sounds not very useful for single objects,
  118.     performing this method on objects that handle children
  119.     can become very handy. In this case, all the children
  120.     (any maybe their children) are searched against <udata>
  121.     and the first matching objects will be asked for the
  122.     specified attribute.
  123.  
  124.     INPUTS
  125.     udata   - userdata to look for.
  126.     attr    - attribute to get.
  127.     storage - place to store the attribute.
  128.  
  129.     NOTES
  130.     If you have many objects in your application, MUIM_GetUData
  131.     may take quite long. You can limit the amount of time
  132.     by performing the method not on the application but on the
  133.     window or even on the group/family your objects are place in.
  134.  
  135.     SEE ALSO
  136.     MUIM_SetUData, MUIM_FindUData
  137. Notify.mui/MUIM_KillNotify
  138.  
  139.     NAME
  140.     MUIM_KillNotify (V4)
  141.  
  142.     SYNOPSIS
  143.     DoMethod(obj,MUIM_KillNotify,ULONG TrigAttr);
  144.  
  145.     FUNCTION
  146.     MUIM_KillNotify kills previously given notifications on specific 
  147.     attributes.
  148.  
  149.     INPUTS
  150.     TrigAttr - Attribute for which the notify was specified. If you
  151.                set up more than one notify for an attribute, only
  152.                the first one will be killed.
  153.  
  154.     EXAMPLE
  155.     DoMethod(button,MUIM_KillNotify,MUIA_Pressed);
  156.  
  157.     SEE ALSO
  158.     MUIM_Notify
  159. Notify.mui/MUIM_MultiSet
  160.  
  161.     NAME
  162.     MUIM_MultiSet (V7)
  163.  
  164.     SYNOPSIS
  165.     DoMethod(obj,MUIM_MultiSet,ULONG attr, ULONG val, APTR obj, /* ... */);
  166.  
  167.     FUNCTION
  168.     Set an attribute for multiple objects.
  169.     Receiving an attribute/value pair and a list of objects,
  170.     this method sets the new value for all the objects in the list.
  171.     This is especially useful for disabling/enabling lots of
  172.     objects with one singe function call.
  173.  
  174.     The object that executes this method isn't affected!
  175.  
  176.     Note: This method was implemented in version 7 of notify class.
  177.  
  178.     INPUTS
  179.     attr     attribute to set.
  180.     value    new value for the attribute.
  181.     obj, ... list of MUI objects, terminated with a NULL pointer.
  182.  
  183.     EXAMPLE
  184.     /* disable all the address related gadgets... */
  185.  
  186.     DoMethod(xxx, MUIM_MultiSet, MUIA_Disabled, TRUE,
  187.        ST_Name, ST_Street, ST_City, ST_Country, ST_Phone, NULL);
  188.  
  189.     /* note that the xxx object doesn't get disabled! */
  190.  
  191.     SEE ALSO
  192.     MUIM_Set, MUIM_Notify
  193. Notify.mui/MUIM_Notify
  194.  
  195.     NAME
  196.     MUIM_Notify (V4)
  197.  
  198.     SYNOPSIS
  199.     DoMethod(obj,MUIM_Notify,ULONG TrigAttr, ULONG TrigVal, APTR DestObj, ULONG FollowParams, /* ... */);
  200.  
  201.     FUNCTION
  202.     Add a notification event handler to an object. Notification
  203.     is essential for every MUI application.
  204.  
  205.     A notification statement consists of a source object,
  206.     an attribute/value pair, a destination object and a
  207.     notification method. The attribute/value pair belongs
  208.     to the source object and determines when the notification
  209.     method will be executed on the destination object.
  210.  
  211.     Whenever the source object gets the given attribute set to
  212.     the given value (this can happen because of the user
  213.     pressing some gadgets or because of your program explicitly
  214.     setting the attribute with SetAttrs()), the destination
  215.     object will execute the notification method.
  216.  
  217.     With some special values, you can trigger the notification
  218.     every time the attribute is changing. In this case, you
  219.     can include the triggering attributes value within the
  220.     notification method. See below.
  221.  
  222.     One big problem with notification are endless loops.
  223.     Imagine you have a prop gadget and want to show its
  224.     state with a gauge object. You connect MUIA_Prop_First
  225.     with MUIA_Gauge_Max and everything is fine, the gauge
  226.     gets updated when the user drags around the gadget. On
  227.     the other hand, if your program sets the gauge to a new
  228.     value, you might want your prop gadget to immediately
  229.     show this change and connect MUIA_Gauge_Max width
  230.     MUIA_Prop_First. Voila, a perfect endless loop.
  231.  
  232.     To avoid these conditions, MUI always checks new
  233.     attribute values against the current state and
  234.     cancels notification when both values are equal.
  235.     Thus, setting MUIA_Prop_First to 42 if the prop
  236.     gadgets first position is already 42 won't trigger
  237.     any notification event.
  238.  
  239.     INPUTS
  240.     TrigAttr     attribute that triggers the notification.
  241.  
  242.     TrigValue    value that triggers the notification. The
  243.                  special value MUIV_EveryTime makes MUI execute
  244.                  the notification method every time when
  245.                  TrigAttr changes. In this case, the special
  246.                  value MUIV_TriggerValue in the notification
  247.                  method will be replaced with the value
  248.                  that TrigAttr has been set to. You can use
  249.                  MUIV_TriggerValue up to four times in one
  250.                  notification method. Since version 8 of
  251.                  muimaster.library, you can also use
  252.                  MUIV_NotTriggerValue here. In this case,
  253.                  MUI will replace TRUE values with FALSE
  254.                  and FALSE values with TRUE. This
  255.                  can become quite useful when you try to set
  256.                  "negative" attributes like MUIA_Disabled.
  257.  
  258.     DestObj      object on which to perform the notification
  259.                  method.
  260.  
  261.     FollowParams number of following parameters. If you e.g.
  262.                  have a notification method with three parts
  263.                  (maybe MUIM_Set,attr,val), you have to set
  264.                  FollowParams to 3. This allows MUI to copy
  265.                  the complete notification method into a
  266.                  private buffer for later use.
  267.  
  268.     ...          following is the notification method.
  269.  
  270.     EXAMPLE
  271.  
  272.     /*
  273.     ** Every time when the user releases a button
  274.     ** (and the mouse is still over it), the button object
  275.     ** gets its MUIA_Pressed attribute set to FALSE.
  276.     ** Thats what a program can react on with notification,
  277.     ** e.g. by openening another window.
  278.     */
  279.  
  280.     DoMethod(buttonobj,MUIM_Notify,
  281.        MUIA_Pressed, FALSE,                /* attribute/value pair */
  282.        windowobj,                          /* destination object   */
  283.        3,                                  /* 3 following words    */
  284.        MUIM_Set, MUIA_Window_Open, TRUE);  /* notification method  */
  285.  
  286.     /*
  287.     ** Lets say we want to show the current value of a
  288.     ** prop gadget somewhere in a text field:
  289.     */
  290.  
  291.     DoMethod(propobj,MUIM_Notify,      /* notification is triggered   */
  292.        MUIA_Prop_First, MUIV_EveryTime /* every time the attr changes */
  293.        textobj                         /* destination object */
  294.        4,                              /* 4 following words  */
  295.        MUIM_SetAsString, MUIA_Text_Contents,
  296.        "value is %ld !", MUIV_TriggerValue);
  297.        /* MUIV_TriggerValue will be replaced with the
  298.           current value of MUIA_Prop_First */
  299.  
  300.     /*
  301.     ** Inform our application when the user hits return
  302.     ** in a string gadget:
  303.     */
  304.  
  305.     DoMethod(stringobj,MUIM_Notify,
  306.        MUIA_String_Acknowledge, MUIV_EveryTime,
  307.        appobj, 2, MUIM_Application_ReturnID, ID_FOOBAR);
  308. Notify.mui/MUIM_Set
  309.  
  310.     NAME
  311.     MUIM_Set (V4)
  312.  
  313.     SYNOPSIS
  314.     DoMethod(obj,MUIM_Set,ULONG attr, ULONG val);
  315.  
  316.     FUNCTION
  317.     Set an attribute to a value. Normally, you would set
  318.     attributes with intuition.library SetAttrs() or with
  319.     the OM_SET method as with any other boopsi objects.
  320.     But since these calls need a complete tag list, not
  321.     just a single attribute/value pair, they are not
  322.     useful within a MUIM_Notify method.
  323.  
  324.     INPUTS
  325.     attr  attribute you want to set.
  326.     val   value to set the attribute to.
  327.  
  328.     EXMAPLE
  329.     DoMethod(strobj,MUIM_Set,MUIA_String_Contents,"foobar");
  330.     and
  331.     SetAttrs(strobj,MUIA_String_Contents,"foobar",TAG_DONE);
  332.     are equal.
  333.  
  334.     SEE ALSO
  335.     MUIM_SetAsString, MUIM_Notify
  336. Notify.mui/MUIM_SetAsString
  337.  
  338.     NAME
  339.     MUIM_SetAsString (V4)
  340.  
  341.     SYNOPSIS
  342.     DoMethod(obj,MUIM_SetAsString,ULONG attr, char *format, ULONG val, /* ... */);
  343.  
  344.     FUNCTION
  345.     Set a (text kind) attribute to a string. This can be useful
  346.     if you want to connect a numeric attribute of an object with
  347.     a text attribute of another object.
  348.  
  349.     INPUTS
  350.     attr    attribute to set.
  351.     format  C like formatting string, remember to use "%ld" !
  352.     val,... one or more paremeters for the format string.
  353.  
  354.     EXAMPLE
  355.  
  356.     stand alone:
  357.  
  358.     DoMethod(txobj,MUIM_SetAsString,MUIA_Text_Contents,
  359.              "My name is %s and I am %ld years old.",name,age);
  360.  
  361.     within a notification statement:
  362.  
  363.     DoMethod(propobj,MUIM_Notify,MUIA_Prop_First,MUIV_EveryTime,
  364.              txobj,4,MUIM_SetAsString,MUIA_Text_Contents,
  365.              "prop gadget shows %ld.",MUIV_TriggerValue);
  366.  
  367.     SEE ALSO
  368.     MUIM_Set, MUIM_Notify
  369. Notify.mui/MUIM_SetUData
  370.  
  371.     NAME
  372.     MUIM_SetUData (V8)
  373.  
  374.     SYNOPSIS
  375.     DoMethod(obj,MUIM_SetUData,ULONG udata, ULONG attr, ULONG val);
  376.  
  377.    FUNCTION
  378.     This method tests if the MUIA_UserData of the object
  379.     contains the given <udata> and sets <attr> to
  380.     <val> for itself in this case.
  381.  
  382.     Altough this sounds not very useful for single objects,
  383.     performing this method on objects that handle children
  384.     can become very handy. In this case, all the children
  385.     (any maybe their children) are tested against <udata>
  386.     and all matching objects will get the attribute set.
  387.  
  388.     If you e.g. want to clear several string gadgets in
  389.     your applciation at once, you simply give them the
  390.     same MUIA_UserData and use
  391.  
  392.     DoMethod(app,MUIM_SetUData,MyUDATA,MUIA_String_Contents,NULL);
  393.  
  394.     INPUTS
  395.     udata - userdata to look for.
  396.     attr  - attribute to set.
  397.     val   - value to set attribute to.
  398.  
  399.     NOTES
  400.     If you have many objects in your application, MUIM_SetUData
  401.     may take quite long. You can limit the amount of time
  402.     by performing the method not on the application but on the
  403.     window or even on the group your gadgets are place in.
  404.  
  405.     SEE ALSO
  406.     MUIM_GetUData, MUIM_FindUData
  407. Notify.mui/MUIM_WriteLong
  408.  
  409.     NAME
  410.     MUIM_WriteLong (V6)
  411.  
  412.     SYNOPSIS
  413.     DoMethod(obj,MUIM_WriteLong,ULONG val, ULONG *memory);
  414.  
  415.     FUNCTION
  416.     This method simply writes a longword somewhere to memory.
  417.     Although this seems quite useless, it might become handy
  418.     if used within a notify statement. For instance, you could
  419.     easily connect the current level of a slider with some
  420.     member of your programs data structures.
  421.  
  422.     INPUTS
  423.     val    - value to write
  424.     memory - location to write the value to
  425.  
  426.     EXAMPLE
  427.  
  428.     /* Let the slider automagically write its level to a variable */
  429.  
  430.     static LONG level;
  431.  
  432.     DoMethod(slider,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  433.        slider,3,MUIM_WriteLong,MUIV_TriggerValue,&level);
  434.  
  435.     SEE ALSO
  436.     MUIM_WriteString, MUIM_Notify
  437. Notify.mui/MUIM_WriteString
  438.  
  439.     NAME
  440.     MUIM_WriteString (V6)
  441.  
  442.     SYNOPSIS
  443.     DoMethod(obj,MUIM_WriteString,char *str, char *memory);
  444.  
  445.     FUNCTION
  446.     This method simply copies a string somewhere to memory.
  447.     Although this seems quite useless, it might become handy
  448.     if used within a notify statement. For instance, you could
  449.     easily connect the current contents of a string gadget
  450.     with some member of your programs data structures.
  451.  
  452.     Note: The string is copied with strcpy(), you must assure
  453.               that the destination points to enough memory.
  454.  
  455.     INPUTS
  456.     str    - string to copy
  457.     memory - location to write the value to
  458.  
  459.     EXAMPLE
  460.  
  461.     static char buffer[256];
  462.  
  463.     DoMethod(string,MUIM_Notify,MUIA_String_Contents,MUIV_EveryTime,
  464.        string,3,MUIM_WriteString,MUIV_TriggerValue,buffer);
  465.  
  466.     SEE ALSO
  467.     MUIM_WriteLong, MUIM_Notify
  468. Notify.mui/MUIA_AppMessage
  469.  
  470.     NAME
  471.     MUIA_AppMessage -- (V5) [..G], struct AppMessage *
  472.  
  473.     FUNCTION
  474.     When your window is an AppWindow, i.e. you have set the
  475.     MUIA_Window_AppWindow attribute to TRUE, you will be able
  476.     to get AppMessages by listening to MUIA_AppMessage.
  477.     Whenever an AppMessage arrives, this attribute will
  478.     be set to a pointer to that message.
  479.  
  480.     MUIA_AppMessage is object specific. You can e.g. set up
  481.     different notifications for different objects in your window,
  482.     they will only get exectued when icons are dropped over the
  483.     specific object.
  484.  
  485.     If you wait on MUIA_AppMessage with a window object, your
  486.     notify will always get executed when icons are dropped on
  487.     the window.
  488.  
  489.     Notes:
  490.  
  491.     - You should use the MUIM_CallHook method to call a
  492.       hook function when an AppMessage arrives (see below).
  493.       The pointer to the AppMessage is valid only as long as 
  494.       the notification method is executed.
  495.  
  496.     - AppWindows are only possible on the workench screen.
  497.  
  498.  
  499.     EXAMPLE
  500.  
  501.     /* Call the AppMsgHook when an icon is dropped on a listview */
  502.  
  503.     DoMethod(lvobj,MUIM_Notify,MUIA_AppMessage,MUIV_EveryTime,
  504.              lvobj,3,MUIM_CallHook,&AppMsgHook,MUIV_TriggerValue);
  505.  
  506.     /* Call the AppMsgHook when an icon is dropped on the window */
  507.  
  508.     DoMethod(winobj,MUIM_Notify,MUIA_AppMessage,MUIV_EveryTime,
  509.              winobj,3,MUIM_CallHook,&AppMsgHook,MUIV_TriggerValue);
  510.  
  511.     SEE ALSO
  512.     MUIA_Window_AppWindow, MUIA_Application_DropObject, MUIM_CallHook
  513. Notify.mui/MUIA_HelpFile
  514.  
  515.     NAME
  516.     MUIA_HelpFile -- (V4) [ISG], STRPTR (OBSOLETE)
  517.  
  518.     FUNCTION
  519.     Since muimaster.library V8, this attribute is obsolete and
  520.     replaced by MUIA_Application_HelpFile.
  521.  
  522.     SEE ALSO
  523.     MUIA_Application_HelpFile, MUIA_HelpNode, MUIA_HelpLine
  524. Notify.mui/MUIA_HelpLine
  525.  
  526.     NAME
  527.     MUIA_HelpLine -- (V4) [ISG], LONG
  528.  
  529.     FUNCTION
  530.     Define a line in a help file specified with 
  531.     MUIA_Application_HelpFile.
  532.  
  533.     SEE ALSO
  534.     MUIA_Application_HelpFile, MUIA_HelpNode
  535. Notify.mui/MUIA_HelpNode
  536.  
  537.     NAME
  538.     MUIA_HelpNode -- (V4) [ISG], STRPTR
  539.  
  540.     FUNCTION
  541.     Define a node in a help file specified with
  542.     MUIA_Application_HelpFile.
  543.  
  544.     SEE ALSO
  545.     MUIA_Application_HelpFile, MUIA_HelpLine
  546. Notify.mui/MUIA_NoNotify
  547.  
  548.     NAME
  549.     MUIA_NoNotify -- (V7) [.S.], BOOL
  550.  
  551.     FUNCTION
  552.     If you set up a notify on an attibute to react on user input,
  553.     you will also recognize events when you change this attribute
  554.     under program control with SetAttrs(). Setting MUIA_NoNotify
  555.     together with your attribute will prevent this notification
  556.     from being triggered.
  557.  
  558.     NOTE
  559.     MUIA_NoNotify is a "one time" attribute. Its only valid during
  560.     the current SetAttrs() call!
  561.  
  562.     EXAMPLE
  563.     SetAttrs(slider,MUIA_NoNotify,TRUE,MUIA_Slider_Level,26,TAG_DONE);
  564. Notify.mui/MUIA_Revision
  565.  
  566.     NAME
  567.     MUIA_Revision -- (V4) [..G], LONG
  568.  
  569.     FUNCTION
  570.     Get the revision number of an objects class. Although
  571.     MUIA_Revision is documented at notify class, you will
  572.     of course receive the revision number of the objects true
  573.     class.
  574.  
  575.     EXAMPLE
  576.     strobj = MUI_NewObject(MUIC_String,...,TAG_DONE);
  577.         ...
  578.     get(strobj,MUIA_Version ,&v);
  579.     get(strobj,MUIA_Revision,&r);
  580.     printf("String class version %ld.%ld\n",v,r);
  581.  
  582.     SEE ALSO
  583.     MUIA_Version
  584. Notify.mui/MUIA_UserData
  585.  
  586.     NAME
  587.     MUIA_UserData -- (V4) [ISG], ULONG
  588.  
  589.     FUNCTION
  590.     A general purpose value to fill in any kind of information.
  591. Notify.mui/MUIA_Version
  592.  
  593.     NAME
  594.     MUIA_Version -- (V4) [..G], LONG
  595.  
  596.     FUNCTION
  597.     Get the version number of an objects class. Although
  598.     MUIA_Version is documented at notify class, you will
  599.     of course receive the version number of the objects true
  600.     class.
  601.  
  602.     EXAMPLE
  603.     strobj = MUI_NewObject(MUIC_String,...,TAG_DONE);
  604.         ...
  605.     get(strobj,MUIA_Version ,&v);
  606.     get(strobj,MUIA_Revision,&r);
  607.     printf("String class version %ld.%ld\n",v,r);
  608.  
  609.     SEE ALSO
  610.     MUIA_Revision
  611.