Hi,
I am trying to add a toolbar to the below program, the program started as clicktabexample.c and I am trying to add in functionality from imagebut.c.
I didn't get that far, can someone take a look at it please and post back.
Cheers
/* ************************************************************ ** ** Created by: CodeBench 0.13 (16.02.2010) ** ** Project: Smile ** ** File: ** ** Date: 04-04-2011 20:32:08 ** ************************************************************ */ #include <dos/dos.h> #include <exec/exec.h> #include <intuition/intuition.h> #include <classes/window.h> #include <images/bitmap.h> #include <gadgets/layout.h> #include <gadgets/clicktab.h> #include <gadgets/button.h> #include <proto/exec.h> #include <proto/intuition.h> #include <proto/window.h> #include <proto/layout.h> #include <proto/clicktab.h> #include <proto/bitmap.h> #include <reaction/reaction_macros.h> #define OBJ(x) Objects[x] #define GAD(x) (struct Gadget *)Objects[x] Object *win; struct MsgPort *AppPort; struct Screen *screen; enum { OBJ_TOPTABS, OBJ_TOOLBAR, OBJ_CLICKTAB_1, OBJ_CLICKTAB_2, OBJ_CLICKTAB_3, OBJ_QUIT, OBJ_NUM }; enum { OBJ_IBUT_1, OBJ_SEL, OBJ_UNSEL, OBJ_IBUT_2, OBJ_GHOST, OBJ_UNGHOST, }; Object *Objects[OBJ_NUM]; #define OBJ(x) Objects[x] #define GAD(x) (struct Gadget *)Objects[x] STRPTR TopTabs[] = {"Feeds", "Items", "Images", NULL}; STRPTR PageLabels_1[] = {"Required","Optional", "Extensions", "Advanced", NULL}; STRPTR PageLabels_2[] = {"Required","Optional", "Advanced", NULL}; STRPTR PageLabels_3[] = {"Image", "Editor", "Advanced",NULL}; struct Hook newprefshook; VOID prefshookfunc( struct Hook *me, APTR winobj, APTR reserved ) { IExec->DebugPrintF("new prefs hook called\n"); } Object * make_window(void) { /* create hook */ newprefshook.h_Entry = (HOOKFUNC)prefshookfunc; newprefshook.h_SubEntry = NULL; newprefshook.h_Data = NULL; Object *page1 = NULL, *page1a = NULL, *page1b = NULL, *page1c = NULL, *page1d = NULL, *page2 = NULL, *page2a = NULL, *page2b = NULL, *page2c = NULL, *page3 = NULL, *page3a = NULL, *page3b = NULL, *page3c = NULL; // Some CHILD_WeightedHeight tags have been left // out to demonstrate the effects of the tag. page1a = IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation, LAYOUT_ORIENT_VERT, LAYOUT_AddChild, IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 1", TAG_DONE), LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 2", TAG_DONE), TAG_DONE), CHILD_WeightedHeight, 0, TAG_DONE); page1b = IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation, LAYOUT_ORIENT_VERT, LAYOUT_AddChild, IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 3", TAG_DONE), LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 4", TAG_DONE), TAG_DONE), CHILD_WeightedHeight, 0, TAG_DONE); page1c = IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation, LAYOUT_ORIENT_VERT, LAYOUT_AddChild, IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 5", TAG_DONE), LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 6", TAG_DONE), TAG_DONE), CHILD_WeightedHeight, 0, TAG_DONE); page1d = IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation, LAYOUT_ORIENT_VERT, LAYOUT_AddChild, IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 7", TAG_DONE), LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 8", TAG_DONE), TAG_DONE), CHILD_WeightedHeight, 0, TAG_DONE); page1 = OBJ(OBJ_CLICKTAB_1) = IIntuition->NewObject(NULL, "clicktab.gadget", GA_Text, PageLabels_1, CLICKTAB_Current, 0, CLICKTAB_PageGroup, IIntuition->NewObject(NULL, "page.gadget", PAGE_Add, page1a, PAGE_Add, page1b, PAGE_Add, page1c, PAGE_Add, page1d, TAG_DONE), TAG_DONE); page2a = IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation, LAYOUT_ORIENT_VERT, LAYOUT_AddChild, IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 9", TAG_DONE), LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 10", TAG_DONE), TAG_DONE), CHILD_WeightedHeight, 0, TAG_DONE); page2b = IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation, LAYOUT_ORIENT_VERT, LAYOUT_AddChild, IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 11", TAG_DONE), LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 12", TAG_DONE), TAG_DONE), CHILD_WeightedHeight, 0, TAG_DONE); page2c = IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation, LAYOUT_ORIENT_VERT, LAYOUT_AddChild, IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 13", TAG_DONE), LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 14", TAG_DONE), TAG_DONE), CHILD_WeightedHeight, 0, TAG_DONE); page2 = OBJ(OBJ_CLICKTAB_2) = IIntuition->NewObject(NULL, "clicktab.gadget", GA_Text, PageLabels_2, CLICKTAB_Current, 0, CLICKTAB_PageGroup, IIntuition->NewObject(NULL, "page.gadget", PAGE_Add, page2a, PAGE_Add, page2b, PAGE_Add, page2c, TAG_DONE), TAG_DONE); page3a = IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation, LAYOUT_ORIENT_VERT, LAYOUT_AddChild, IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 15", TAG_DONE), LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 16", TAG_DONE), TAG_DONE), CHILD_WeightedHeight, 0, TAG_DONE); page3b = IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation, LAYOUT_ORIENT_VERT, LAYOUT_AddChild, IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 17", TAG_DONE), LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 18", TAG_DONE), TAG_DONE), CHILD_WeightedHeight, 0, TAG_DONE); page3c = IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation, LAYOUT_ORIENT_VERT, LAYOUT_AddChild, IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 19", TAG_DONE), LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "Button 20", TAG_DONE), TAG_DONE), CHILD_WeightedHeight, 0, TAG_DONE); page3 = OBJ(OBJ_CLICKTAB_3) = IIntuition->NewObject(NULL, "clicktab.gadget", GA_Text, PageLabels_3, CLICKTAB_Current, 0, CLICKTAB_PageGroup, IIntuition->NewObject(NULL, "page.gadget", PAGE_Add, page3a, PAGE_Add, page3b, PAGE_Add, page3c, TAG_DONE), TAG_DONE); OBJ(OBJ_TOPTABS) = IIntuition->NewObject(NULL, "clicktab.gadget", GA_Text, TopTabs, CLICKTAB_Current, 0, CLICKTAB_PageGroup, IIntuition->NewObject(NULL, "page.gadget", PAGE_Add, page1, PAGE_Add, page2, PAGE_Add, page3, TAG_DONE), TAG_DONE); /* OBJ(OBJ_IBUT_1) = ButtonObject, BUTTON_BevelStyle, BVS_NONE, BUTTON_Transparent, TRUE, BUTTON_RenderImage, OBJ(OBJ_SEL) = BitMapObject, BITMAP_SourceFile, "tbimages:world", BITMAP_DisabledSourceFile, "tbimages:world_g", BITMAP_Screen, screen, BITMAP_Masking, TRUE, BitMapEnd, BUTTON_SelectImage, OBJ(OBJ_UNSEL) = BitMapObject, BITMAP_SourceFile, "tbimages:world_s", BITMAP_Screen, screen, BITMAP_Masking, TRUE, BitMapEnd, ButtonEnd; OBJ(OBJ_TOOLBAR) = (LAYOUT_AddChild, OBJ(OBJ_IBUT_1) ); // CHILD_WeightedWidth, 0, // CHILD_WeightedHeight, 0); */ return IIntuition->NewObject(NULL, "window.class", WA_ScreenTitle, "ReAction Example", WA_Title, "ClickTab Example", WA_DragBar, TRUE, WA_CloseGadget, TRUE, WA_SizeGadget, TRUE, WA_DepthGadget, TRUE, WA_Activate, TRUE, WINDOW_IconifyGadget, TRUE, WINDOW_IconTitle, "Iconified", WINDOW_AppPort, AppPort, WINDOW_NewPrefsHook, &newprefshook, WINDOW_Position, WPOS_CENTERSCREEN, WINDOW_Layout, IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation, LAYOUT_ORIENT_VERT, // LAYOUT_AddChild, OBJ(OBJ_TOOLBAR), LAYOUT_AddChild, OBJ(OBJ_TOPTABS), LAYOUT_AddChild, IIntuition->NewObject(NULL, "button.gadget", GA_Text, "_Quit", GA_ID, OBJ_QUIT, GA_RelVerify, TRUE, TAG_DONE), CHILD_WeightedHeight, 0, TAG_DONE), TAG_DONE); } int main() { struct Window *window; if (screen=IIntuition->LockPubScreen(NULL)) { win = make_window(); if (window = RA_OpenWindow(win)) { uint32 sigmask = 0, siggot = 0, result = 0; uint16 code = 0, ghost = 0; BOOL done = FALSE; IIntuition->GetAttr(WINDOW_SigMask, win, &sigmask); } if (AppPort = IExec->AllocSysObjectTags(ASOT_PORT, TAG_DONE)) { if (window = (struct Window*)IIntuition->IDoMethod(win, WM_OPEN)) { uint32 sigmask = 0, siggot = 0, result = 0; uint16 code = 0; BOOL done = FALSE; IIntuition->GetAttr(WINDOW_SigMask, win, &sigmask); while (!done) { siggot = IExec->Wait(sigmask | SIGBREAKF_CTRL_C); if (siggot & SIGBREAKF_CTRL_C) done = TRUE; while ((result = IIntuition->IDoMethod(win, WM_HANDLEINPUT, &code))) { switch(result & WMHI_CLASSMASK) { case WMHI_CLOSEWINDOW: done = TRUE; break; case WMHI_GADGETUP: switch (result & WMHI_GADGETMASK) { case OBJ_QUIT: done=TRUE; break; } break; case WMHI_ICONIFY: if (IIntuition->IDoMethod(win, WM_ICONIFY)) window = NULL; break; case WMHI_UNICONIFY: window = (struct Window*)IIntuition->IDoMethod(win, WM_OPEN); break; } } } } if (win) IIntuition->DisposeObject(win); // if (OBJ(OBJ_UNGHOST)) IIntuition->DisposeObject(OBJ(OBJ_UNGHOST)); // if (OBJ(OBJ_GHOST)) IIntuition->DisposeObject(OBJ(OBJ_GHOST)); // if (OBJ(OBJ_UNSEL)) IIntuition->DisposeObject(OBJ(OBJ_UNSEL)); // if (OBJ(OBJ_SEL)) IIntuition->DisposeObject(OBJ(OBJ_SEL)); // IIntuition->UnlockPubScreen(NULL,screen); IExec->FreeSysObject(ASOT_PORT, AppPort); } } }
To create toolbars, use speedbar.gadget, not a row of button.gadgets!
First you'll need to create a bitmap.image for each toolbar button:
Then allocate an Exec list for the speedbar:
Then you must add the speedbar buttons. They are added as list nodes
add_sbar_node(listSpeedBar, 1, bitmap1);
add_sbar_node(listSpeedBar, 2, bitmap2);
add_sbar_node(listSpeedBar, 3, bitmap3);
etc., using the function below:
Finally, you create the speedbar object:
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
I suppose that might work, but AISS icons have a selected state as well (not just the recess), just check out the refresh button in OWB, the arrows change position.
But its a good start anyway.. gives me some progress.
Now gotta work out to add menus... not getting far with that either.
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
This is the code that I use in DiskImageGUI to load AISS images:
Hello,
Okay I need a brave soul, I downloaded GUIDesigner by Tuomas Hokka.
http://www.os4depot.net/index.php?function=showfile&file=development/guitool/guidesigner.lha
And successfully built part of a GUI, but the program doesn't produce code as such just the XML layout of the buttons and such like. Now sadly the GUIDesigner doesn't allow me to add ClickTabs and numerous other things like Labels and File buttons.
I was hoping someone could download the .project files load them into GUIDesigner. hit the Create Code button and get them into a useable C source code that I can pick up and run with it. Not only that, I need some menus so need basic structure in there that I can go ahead and edit at well.
Also if someone can look at the layout files and replace where it says 'this should be a clicktab', 'this should be a label' etc etc etc
Yeah I know I am asking a lot, but if someone can do that for me - well that would be amazing helpful!!!
Okay so the project files, http://www.beaverpromotions.co.uk/smile.lha.
Wanted to hosted them on amigaos.net, but well I left the Mac at work and I haven't got an ftp client configured for sftp connections yet so the above link for now.
Once again, aside from GUIDesigner there is no decent Gui builder for OS4 and I can't wait for AVD so if you have an hour or two to devote to getting me up and running I would be truly grateful.
OR ALTERNATIVELY:
If you can import at least one layout from GUIDesigner to look the same in Emperor that would be just as impressive as I could take it from there, but alas I cannot not fathom Emperor out.. the layout all appears to be broken or at least in the preview window. :S
Cheers, Rick.
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
@djrikki
I've never used GUIDesigner so I can't help you with that, but if you just need example source on how to create and use labels, file buttons and clicktabs then SRec GUI has all of those and you are free to browse and download its source code on sourceforge.net (the part that would probably be of most interest to you would be the CreateSRecGUI function):
http://srec.svn.sourceforge.net/viewvc/srec/src/gui.c?revision=1&view=markup
BTW your project files link doesn't work as there's an extra dot ('.') at the end of the url.
I'll take a look when I get home.
Sorry yeah the url is http://www.beaverpromotions.co.uk/smile.lha
Salass00, GUIDesigner is a tiny program, when you a load project in it and hit the Create Code button it outputs the code to RAM Disk. It takes less than 5 minutes to look at it.
Basically its just the pure structure ya know, Add_Child blah blah Layout_Orientation = HORIZ... all that stuff.
I will take a look at source code you mentioned as well.
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
I've actually returned to Emperor and had a lot of success this evening once I started toggling with the Fixed Height and Width Layout buttons for Horiz/Vert Layout objects. They solved the problem I was having.
But a new problem has arrised, best show you a screen shot.
Click here for image
I have a Click Tab with 3 pages called 'Top Level Tabs' in the structure - Feeds, Images and Items.
I can access the Feeds page just fine, but when I click on the tab of the other pages its not showing anything!!! I feel I've already tried every combination under the sun.
Here is the project file that you can load straight into Emperor and see what I mean.
Right-Click to download
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
@ salass00
Have you taken a look at the project yet in Emperor to see where I am going wrong? Kas1e says your a bit of an expert at Reaction layouts, and well we know he is personally busy with MUI-OWB.
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
I'm afraid you're going wrong in trying to use half-baked GUI builders no one really uses :-)
This bit caught my eye:
vertical page Images
horizontal page 8
vertical layout 11
Items toolbar
Listbrowser 1
What are the two page objects here? They are not both page.gadgets, are they? Why would you put a page inside a page in such a simple layout?
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
If I have followed the instructions in Emperor.guide correctly, this was necessary to get the ClickTabs working.
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
AFAIK you only associate one page.gadget with a clicktab.gadget. The individual pages under the tabs are layouts, not page.gadgets.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
It's possible that Emperor hides this detail from the user. At least I couldn't find any way to create page gadgets with it.
@salass00
Yes, that's possible. This is why it's quite difficult to give advice if you don't know what's going on inside Emperor.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
@djrikki
If I interpret your example you have done it like this:
but if I read the Guides/ClicktabExample.README! I would do it like:
I have no OS4, so I can't try it out but you can.