I have a layout designed and working just fine. But let's say I don't want to create one of the gadgets, by user choice, in the layout. How do I "skip over it"?
I have been doing this:
!Prefs->StatusBar ? TAG_IGNORE : StartHGroup, LAYOUT_BevelStyle, BVS_SBAR_VERT, LAYOUT_SpaceOuter, TRUE, LAYOUT_FixedVert, FALSE, LAYOUT_InnerSpacing, 0, LAYOUT_LeftSpacing, 0, LAYOUT_RightSpacing, 0, LAYOUT_TopSpacing, 0, LAYOUT_BottomSpacing, 0, LAYOUT_AddChild, Objects[GAD_STATUSBAR]=NewObject(ButtonClass,NULL, GA_ID, GAD_STATUSBAR, GA_ReadOnly, TRUE, GA_Underscore, "^", GA_Text, "", BUTTON_BevelStyle, BVS_NONE, BUTTON_Justification, BCJ_LEFT, TAG_END), EndHGroup,
This works fine. But for some reason when I do display the gadget all the memory is freed. When I don't display the gadget I lose 3,800 bytes.
Is there a better way to "skip over" a gadget when creating the layout?
Are you sure that is the exact code you are using because I don't see how it could work at all?
Anyway you need to do something like this:
Or you could create the status bar separately:
and then add it to your layout using:
You can't create a Group as an Object, so that doesn't work.
I have tried every combination I can think of. Still have the memory loss issue. I can't add/remove the gadget after layout creation and window open because of the StartHGroup with the horizontal bar.
I will keep trying.....
Thanks
Yes, you can. I notice I made a mistake though in that I forgot to replace the comma in after "EndHGroup" with a semicolon in my example above.
The StartHGroup and EndHGroup are just macros that hide a single call to IIntuition->NewObject() which surprise, surprise returns a pointer to a BOOPSI Object.
Edit:
I just noticed that the Start#? macros include an explicit "LAYOUT_AddChild, " in their definition unlike the #?Object ones I'm familiar with, so just replace StartHGroup with HGroupObject in the code fragments I posted above and it should be fine.
Nice! Changing the group tags did it.
Thank you, sir!