website logo
Auteur
avatar
rusback

Forum » » Développement » » Utilisation de la TheBar.mcc


Post� : 05-06-2011 19:02 icone du post

Bonsoir,

Je fais un petit programme et j'utilises la derniére version de TheBar.mcc dans une interface MUI.
Y a un petit truc que je comprends pas bien...

Voici le code (en partie) de mon programme :
struct MUIS_TheBar_Button buttons[] =
{
{0, 0, "Mails", "Index of mails", 0, 1<<1 | 1<<2 | 1<<4, NULL, NULL},
{1, 1, "Files", "Index of files", 0, 1<<0 | 1<<2 | 1<<3 | 1<<4, NULL, NULL},
{2, 2, "Musics", "Index of musics", 0, 1<<0 | 1<<1 | 1<<3 | 1<<4, NULL, NULL},
{3, 3, "Pictures", "Index of pictures", 0, 1<<0 | 1<<1 | 1<<2 | 1<<4, NULL, NULL},
{4, 4, "Videos", "Index of videos", 0, 1<<0 | 1<<1 | 1<<2 | 1<<3, NULL, NULL},
{MUIV_TheBar_BarSpacer, -1, NULL, NULL, 0, 0, NULL, NULL},
{5, 5, "Options", "Options", 0, 0, NULL, NULL},
{MUIV_TheBar_End, -1, NULL, NULL, 0, 0, NULL, NULL},
};

STRPTR GadImg[] =
{
"Mails",
"Files",
"Musics",
"Pictures",
"Movies",
"Options",
NULL
};

data->GUI.WI = NewObject(CL_MainWin->mcc_Class, NULL,
MUIA_Window_Title, data->WinTitle,
MUIA_HelpNode, "MA_W",
MUIA_Window_ID, MAKE_ID('M','A','I','N'),
MUIA_Window_Menustrip, data->GUI.MS_MAIN,
WindowContents, VGroup,
Child, HGroup,
MUIA_HelpNode, "MA02",
Child, HSpace(5),
Child, data->GUI.TO_TOOLBAR = TheBarObject,
MUIA_Group_Horiz, TRUE,
MUIA_TheBar_ViewMode, MUIV_TheBar_ViewMode_TextGfx,
MUIA_TheBar_LabelPos, MUIV_TheBar_LabelPos_Bottom,
MUIA_TheBar_Borderless, FALSE,
MUIA_TheBar_Buttons, buttons,
MUIA_TheBar_PicsDrawer, "PROGDIR:GADIMG",
MUIA_TheBar_Pics, GadImg,
End,
Child, HSpace(5),
End,
Child, VSpace(5),
Child, data->GUI.GR_PAGE = VGroup,
Child, data->GUI.GR_SUBPAGE = MA_BuildPage(data, 1),
End,
Child, RectangleObject,
MUIA_Rectangle_HBar, TRUE,
MUIA_FixHeight, 4,
End,
.........

if(data->GUI.WI)
{
DoMethod(G->App, OM_ADDMEMBER, data->GUI.WI);

DoMethod(data->GUI.WI, MUIM_Notify, MUIA_Window_MenuAction, MMEN_ABOUT, G->AY_Win, 3, MUIM_Set, MUIA_Window_Open, TRUE);
DoMethod(data->GUI.WI, MUIM_Notify, MUIA_Window_MenuAction, MMEN_ABOUTMUI, MUIV_Notify_Application, 2, MUIM_CallHook, &MA_AboutMUIHook);
DoMethod(data->GUI.WI, MUIM_Notify, MUIA_Window_MenuAction, MMEN_QUIT, MUIV_Notify_Application, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
DoMethod(data->GUI.WI, MUIM_Notify, MUIA_Window_MenuAction, MMEN_MUI, MUIV_Notify_Application, 2, MUIM_Application_OpenConfigWindow, 0);
DoMethod(data->GUI.WI, MUIM_Notify, MUIA_Window_MenuAction, MMEN_LOGIN, MUIV_Notify_Application, 2, MUIM_Application_ReturnID, ID_RESTART);
DoMethod(data->GUI.WI, MUIM_Notify, MUIA_Window_MenuAction, MMEN_HIDE, MUIV_Notify_Application, 3, MUIM_Set, MUIA_Application_Iconified, TRUE);
DoMethod(data->GUI.WI, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, MUIV_Notify_Application, 2, MUIM_Application_ReturnID, ID_CLOSEALL);

DoMethod(buttons[0].obj, MUIM_Notify, MUIA_Pressed, FALSE, G->App, 3, MUIM_CallHook, &MA_ChangePageHook, 0);
DoMethod(buttons[1].obj, MUIM_Notify, MUIA_Pressed, FALSE, G->App, 3, MUIM_CallHook, &MA_ChangePageHook, 1);
DoMethod(buttons[2].obj, MUIM_Notify, MUIA_Pressed, FALSE, G->App, 3, MUIM_CallHook, &MA_ChangePageHook, 2);
DoMethod(buttons[3].obj, MUIM_Notify, MUIA_Pressed, FALSE, G->App, 3, MUIM_CallHook, &MA_ChangePageHook, 3);
DoMethod(buttons[4].obj, MUIM_Notify, MUIA_Pressed, FALSE, G->App, 3, MUIM_CallHook, &MA_ChangePageHook, 4);

return(data);
}
free(data);

MA_BuildPage(x) est la fonction qui change toute l'interface principale
MA_ChangePageHook est l'appel qui lnce ce changement suivant le numéro du bouton (5 boutons 5 environnements différents dans l'interface MUI)

C'est bizarre l'appel à chaque appui sur un des 5 boutons ne fonctionne pas...
Par contre, si je change FALSE par TRUE ca fonctionne 1 fois mais aprés je reviens à mon probléme

Si quelqu'un pouvait me donner un coup de main... je suis en train de m'arracher les cheveux

MorphOS, c'est le meilleur

Cet article provient de Meta-MorphOS
https://www.meta-morphos.org/viewtopic.php?topic=794&forum=52