• Acolyte of the Butterfly
    Acolyte of the Butterfly
    Gelb
    Posts: 148 from 2003/3/4
    From: #amigazeux
    > I'd like to set up a drag gadget over some parts of my
    > mui window (background parts). What's the best way to
    > implement it ??

    Subclass MUIC_Rectangle and do something like

    OBJECT classdata
    ...
    sysgadget:PTR TO LONG
    ...
    ENDOBJECT

    and in your MUIM_Show method you do:

    DEF w:PTR TO window

    IF muiRenderInfo(obj)
    IF w:=_window(obj)
    data.sysgadget:=NewObjectA(0,BUTTONGCLASS,[
    GA_LEFT, _left(obj),
    GA_TOP, _top(obj),
    GA_WIDTH, _width(obj),
    GA_HEIGHT, _height(obj),
    GA_SYSGTYPE, GTYP_WDRAGGING,
    GA_IMMEDIATE, TRUE,
    TAG_DONE])

    IF data.sysgadget THEN AddGadget(w,data.sysgadget,-1) [edit: forgot this vital line :/]
    ENDIF
    ENDIF

    matching the above in your MUIM_Hide with:

    DEF w:PTR TO window

    IF muiRenderInfo(obj)
    IF w:=_window(obj)
    IF data.sysgadget
    RemoveGadget(w, data.sysgadget)
    DisposeObject(data.sysgadget)
    ENDIF
    data.sysgadget:=NIL
    ENDIF
    ENDIF

    If you don't want object dimensions as it will just be some useless HVSpace, use MUIA_FixWidth/Height of 1 and use whatever you like for l/t/w/h in MUIM_Show.

    Note that there are millions of other ways to do it, but I guess the important part here is adding a system gadget to your MUI app.

    The above won't make up for the drag gadget being in the background, so all other objects it overlaps won't receive input anymore.

    If there's no other obvious way to do it (I have found none), you need to traverse through object list of root group object and substract object regions from your intended drag area and add a drag gadget for each remaining region after traversing. At least that's how its done in newer ANR versions.

    Note2: The nice formatting got lost in preview of this post, so I guess the posted post will also have no formatting.
  • »26.09.06 - 22:43
    Profile Visit Website