Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
Who's Online
1 user(s) are online (1 user(s) are browsing Forum)

Members: 0
Guests: 1

more...

Browsing this Thread:   1 Anonymous Users





Zune/MUI DoNotify

Joined:
1/20 18:36
From SF Bay Area, California
Group:
Member
Posts: 11
Offline
I thought I understood how DoNotify works but I'm not so sure now. Lets say I have a VGroup ("group") inside a window to which I want to add new Test:

DoMethod(group, MUIM_Add_Tail, sometext);

This works fine. :)

I thought I could be notified of an event and call a method on a Zune/MUI object... like:

DoMethod(button, MUIM_Notify, MUIA_Pressed, FALSE,
(IPTR)group, 2, MUIM_Add_Tail, sometext);

but this doesn't work at all :(

Other examples I've seen simply drop a magic value into the event loop using MUIM_Application_ReturnID and use this in a switch to dispatch to a function call, or alternatively use a callback hook.

Both approaches are reasonable but I don't understand the limitations of what is permitted in MUIM_Notify.

Can anyone offer any insight here?

Cheers!

Posted on: 2/7 21:54
Transfer the post to other applications Transfer


Re: Zune/MUI DoNotify

Joined:
2011/4/18 7:10
From Germany
Group:
Member
Posts: 603
Offline
Just a wild guess,

but usually you have to set the Group to "Exchange mode" to add/remove items in runtime.

see here:

http://www.sasg.com/mui/autodocs/MUI_ ... tml#MUIM_Group_InitChange

Maybe that the reason it does not work.

You could try the Notify events with an other method, like window, MUIM_Window_ToBack, to test if the method calling is working.

Posted on: 2/7 23:28
Transfer the post to other applications Transfer


Re: Zune/MUI DoNotify

Joined:
2008/2/5 6:58
From Sunny Finland
Group:
Member
Posts: 1014
Offline
I've done this:

Child, HGroup,
Child, tick1 = MUI_MakeObject(MUIO_Checkmark, NULL),
Child, MUI_MakeObject(MUIO_Label,"640x480", 0),
End,

and then:

DoMethod(tick1, MUIM_Notify, MUIA_Selected, TRUE, (IPTR)custom, 3, MUIM_Set, MUIA_Resolution, TRUE);
DoMethod(tick1, MUIM_Notify, MUIA_Selected, FALSE,(IPTR)custom, 3, MUIM_Set, MUIA_Resolution, FALSE);

I don't know about the group class and what the addtail is supposed to do on your code.

My code can be found here: https://trac.aros.org/trac/browser/ARO ... b/guiapps/ps3eye/ps3eye.c

Only hack in that code is when I change the window size. There's a need to close and reopen the window after the new size is selected.

SetAttrs(_win(obj), MUIA_Window_Open, FALSE, MUIA_Window_Open, TRUE, TAG_DONE);

Maybe try to close and reopen the window if it doesn't update the window.

Posted on: 2/8 5:43
Transfer the post to other applications Transfer


Re: Zune/MUI DoNotify

Joined:
1/20 18:36
From SF Bay Area, California
Group:
Member
Posts: 11
Offline
Thanks friends. I tried using a callback hook and MUIM_Group_InitChange/ExitChange and I've at least achieved what I was trying to do.

Here's a working mini-app in case this helps anyone in the future:

#include <stdio.h>
#include <exec/types.h>
#include <exec/libraries.h>
#include <utility/hooks.h>
#include <libraries/mui.h>

#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/muimaster.h>
#include <proto/utility.h>
#include <proto/alib.h>
#include <clib/alib_protos.h>

static struct Hook addItemHook;

static ULONG AddItem(struct Hook *h, Object *o, APTR *msg)
{

Object *sometext;

sometext = TextObject,
MUIA_Text_Contents, "Sometimes you eat the bear.",
End;

if (DoMethod(o, MUIM_Group_InitChange))
{
DoMethod(o, MUIM_Group_AddTail, sometext);
DoMethod(o, MUIM_Group_ExitChange);
}

return 1;
}

int main(void)
{
addItemHook.h_Entry = HookEntry;
addItemHook.h_SubEntry = (HOOKFUNC)AddItem;

Object *app, *wnd, *button, *group;

app = ApplicationObject,
SubWindow, wnd = WindowObject,
MUIA_Window_Title, "Todo Sample App",
WindowContents, group = VGroup,
Child, button = SimpleButton("_Add"),
End,
End,
End;

if (app != NULL)
{
ULONG sigs=0;

DoMethod(wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
(IPTR)app, 2,
MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);

DoMethod(button, MUIM_Notify, MUIA_Pressed, FALSE,
(IPTR)group,2, MUIM_CallHook, (IPTR)&addItemHook);

set(wnd, MUIA_Window_Open, TRUE);

if (XGET(wnd, MUIA_Window_Open))
{
while((LONG)DoMethod(app, MUIM_Application_NewInput, (IPTR)&sigs)
!= MUIV_Application_ReturnID_Quit)
{
if (sigs)
{
sigs = Wait(sigs | SIGBREAKF_CTRL_C);
if (sigs & SIGBREAKF_CTRL_C)
break;
}
}
}
else
{
puts("window not opened!");
}
MUI_DisposeObject(app);
}

return 0;
}

Posted on: 2/8 21:33
Transfer the post to other applications Transfer






You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]


Search
Top Posters
1 paolone
paolone
4375
2 magorium
magorium
4095
3 phoenixkonsole
phoenixkonsole
3897
4 nikolaos
nikolaos
3761
5 deadwood
deadwood
2923
6 ncafferkey
ncafferkey
2693
7 mazze
mazze
2216
8 clusteruk
clusteruk
2111
9 Kalamatee
Kalamatee
2026
10 damocles
damocles
1789
© 2004-2017 AROS Exec