Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
Who is Online
98 user(s) are online (17 user(s) are browsing Forum)

Members: 0
Guests: 98

more...


Browsing this Thread:   1 Anonymous Users






Re: Zune/MUI DoNotify
#4
Quite a regular
Quite a regular


See User information
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: 2018/2/9 5:33
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Re: Zune/MUI DoNotify
#3
Home away from home
Home away from home


See User information
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/AROS/trunk/AROS/rom/usb/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: 2018/2/8 13:43
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Re: Zune/MUI DoNotify
#2
Home away from home
Home away from home


See User information
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_Group.html#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: 2018/2/8 7:28
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 


Zune/MUI DoNotify
#1
Quite a regular
Quite a regular


See User information
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: 2018/2/8 5:54
 Top  Twitter  Facebook  Google Plus  Linkedin  Del.icio.us  Digg  Reddit  Mr. Wong 







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.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[Advanced Search]


Search
Top Posters
1 paolone
paolone
4462
2 nikolaos
nikolaos
4206
3 magorium
magorium
4095
4 phoenixkonsole
phoenixkonsole
3942
5 deadwood
deadwood
2917
6 ncafferkey
ncafferkey
2810
7 mazze
mazze
2222
8 Kalamatee
Kalamatee
2212
9 clusteruk
clusteruk
2114
Powered by XOOPS © 2001-2025 The XOOPS Project