Hi all! How do you position a gadget AFTER said gadget has been created & resized using `ResizeGadget ( )` ?
Any help is GREATLY appreciated!
Thanks alot! <3
Set Gadget's Position?
Re: Set Gadget's Position?

Is this "Hidden camera" ?
With ResizeGadget() of course...
Re: Set Gadget's Position?
I think you misunderstand. I need to move the gadget AFTER ResizeGadget has been used so I can position the gadget in the middle of the screen constantly with the new size of the button being the width & height of the string the button uses.
Re: Set Gadget's Position?
I think you need to reformulate you're question as what you are asking, Bisonte allready answered...Mythros wrote:I think you misunderstand. I need to move the gadget AFTER ResizeGadget has been used so I can position the gadget in the middle of the screen constantly with the new size of the button being the width & height of the string the button uses.
Re: Set Gadget's Position?
Ok, so say I wanted to position the button gadget AFTER resizing it to the width / height of the string so i can put it always in the middle of the screen based on its' new width / height. how can i do that?
Re: Set Gadget's Position?
Do you mean the actual screen or the window? (Still not sure of you intent with thisMythros wrote:Ok, so say I wanted to position the button gadget AFTER resizing it to the width / height of the string so i can put it always in the middle of the screen based on its' new width / height. how can i do that?

For Window?:
Code: Select all
OpenWindow(0,0,0,300,300,"",#PB_Window_SizeGadget)
ButtonGadget(0,0,0,100,100,"ThisAndThat")
ResizeGadget(0,(WindowWidth(0)/2)-(GadgetWidth(0)/2),(WindowHeight(0)/2)-(GadgetHeight(0)/2),#PB_Ignore,#PB_Ignore)
Repeat
event=WaitWindowEvent()
If event=#PB_Event_SizeWindow
ResizeGadget(0,(WindowWidth(0)/2)-(GadgetWidth(0)/2),(WindowHeight(0)/2)-(GadgetHeight(0)/2),#PB_Ignore,#PB_Ignore)
EndIf
Until event=#PB_Event_CloseWindow
Re: Set Gadget's Position?
You can use #PB_Ignore in place of X, Y, Width and Height if you don't want to modify it.
Re: Set Gadget's Position?
The ResizeGadget() command can size and move the gadget at the same time. It's not just for resizing.Mythros wrote:I need to move the gadget AFTER ResizeGadget has been used so I can position the gadget