Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
131 user(s) are online (123 user(s) are browsing Forums)

Members: 0
Guests: 131

more...

Support us!

Headlines

 
  Register To Post  

Bug with Window Gadgets? (Solved)
Quite a regular
Quite a regular


See User information
Two questions, (OS4 release 4.1 Final Update 2 with Enhancer 2.1)

1. Is it required to remove your gadget or gadget list before changing gadget attributes and then add them back after the change?
IIntuition->RemoveGList(windows[WID_MAIN], gadgets[GID_MAIN], -1);
IIntuition->AddGList(windows[WID_MAIN], gadgets[GID_MAIN], 0, -1, NULL);


2. When I do the above I get problem of the Front to back window gadget swaping places with the Resize gadget. Any idea why this happens?

I have some code that creates a window with a bunch of gadgets. When the window first opens the top right Window barder gadgets in the order they should be in. Iconify gadet first, followed by the Resize gadget, then the Front to back gadget frutherst to the right. When I remove all window gadgets, then add them back the Front to back gadget switches places with the Resize gadget, so the Resize gadget is now the right most gadget.

I did a test where I create the window, then remove the gadgets and re-attach the gadgets and the problem occurs. The code looks like this:

windows[WID_MAIN] = (struct Window *) RA_OpenWindow(objects[OID_MAIN]);
display_info_request(objects[OID_MAIN], REQIMAGE_ERROR, "PAUSING PROGRAM!!.\n\n");
IIntuition->RemoveGList(windows[WID_MAIN], gadgets[GID_MAIN], -1);
IIntuition->AddGList(windows[WID_MAIN], gadgets[GID_MAIN], 0, -1, NULL);
display_info_request(objects[OID_MAIN], REQIMAGE_ERROR, "PAUSING PROGRAM!!.\n\n");

When the first requester appears, the gadgets are in the order they should be in.
When the second requester appears, the Front/Back gadget has switched places with the Resize gadget.

Here is my Window structure:
objects[OID_MAIN] = WindowObject,
WA_Title, PROG_NAME PROG_VERSION,
WA_DragBar, TRUE,
WA_CloseGadget, TRUE,
WA_SizeGadget, TRUE,
WA_DepthGadget, TRUE,
WA_NewLookMenus, TRUE,
WA_Activate, TRUE,
WINDOW_IconifyGadget, TRUE,
WINDOW_AppPort, AppPort,
WINDOW_Position, WPOS_CENTERSCREEN,
WINDOW_LockHeight, TRUE,
WINDOW_NewMenu, mynewmenu,
WINDOW_GadgetHelp, cmds.hint_mode,
WINDOW_HintInfo, &mytips,
WINDOW_ParentGroup, gadgets[GID_MAIN] = (struct Gadget *)VLayoutObject,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_SpaceInner, TRUE,
LAYOUT_DeferLayout, TRUE,
LAYOUT_AddChild,SpaceObject,End,


Edited by ktadd on 2022/4/7 18:38:54
AmigaOne X1000, A1222Plus, uA1
Go to top
Re: Bug with Window Gadgets?
Just popping in
Just popping in


See User information
Quote:

1. Is it required to remove your gadget or gadget list before changing gadget attributes and then add them back after the change?


No, as long as the attribute has applicability OM_SET. As it is implementation specific, you have to check the corresponding AutoDoc for each case.

Quote:

2. When I do the above I get problem of the Front to back window gadget swaping places with the Resize gadget. Any idea why this happens?


I was about to write I didn't see this before, but now I see your mistake. You are removing the whole Gadget list from the window, which is NOT what you want. Your gadgets[GID_MAIN] is actually a layout_gc, which you gave to window_cl by using WINDOW_ParentLayout tag.

What you want to do instead, is to tell window_cl to remove the layout and later add the layout again. Something like this (somewhat Pseudocode):

/* Remove the layout from the window object */
SetAttrs(objects[OID_MAIN], WINDOW_LayoutNULLTAG_DONE);

...

/* Add the layout to the window object again */
SetAttrs(objects[OID_MAIN], WINDOW_Layoutgadgets[GID_MAIN], TAG_DONE);


Edited by Cyborg on 2022/4/7 10:22:11
AmigaOS 4 core developer
www.os4welt.de - Die deutsche AmigaOS 4 Gemeinschaft

"In the beginning was CAOS.."
-- Andy Finkel, 1988 (ViewPort article, Oct. 1993)
Go to top
Re: Bug with Window Gadgets?
Quite a regular
Quite a regular


See User information
@Cyborg
Bug fixed. Thanks!

AmigaOne X1000, A1222Plus, uA1
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project