Page 1 of 1
[Implemented] Gadget-Lib: Flag to GadgetX and GadgetY
Posted: Wed Nov 14, 2007 12:08 pm
by CSAUER
I would like to wish a additional flag to receive the absolute positions from GadgetX and GadgetY. The absolute positions are different to the relatives if you have nested gadgets inside a container. Then GadgetX and GadgetY provides you the relative position to the container and not the absolute position inside the window, which can be required to compare them with the absolute mouse position inside the window.
Maybe not a big deal for you, but very helpful for custom GUIs.
http://www.purebasic.fr/english/viewtop ... 684#218684
Posted: Wed Nov 14, 2007 3:07 pm
by AND51
Absolute coordinates?
But what yould you do, if you've got a button inside a ScrollAreagadget() ? If you scroll then, the position will be changed continiously (did I spell that word right^^).
This function would be nice, I appreciate it, although I can't think of a situaion spontaniously in which I could need it.
Posted: Wed Nov 14, 2007 3:31 pm
by gnozal
AND51 wrote:Absolute coordinates?
This function would be nice, I appreciate it, although I can't think of a situaion spontaniously in which I could need it.
Visual designer

Posted: Wed Nov 14, 2007 4:33 pm
by AND51
Sorry, I hardly use the Visual Designer. I create my GUIs manually...

Posted: Wed Nov 14, 2007 4:49 pm
by gnozal
AND51 wrote:Sorry, I hardly use the Visual Designer. I create my GUIs manually...

Sorry, I didn't meant using VD, but creating a VD.
Posted: Wed Nov 14, 2007 5:08 pm
by AND51
Sorry, then I misunderstood you, gnozal.
And now: Stop the "sorrys"!

Posted: Wed Nov 14, 2007 5:37 pm
by AND51
@ CSAUER:
A workaround:
Code: Select all
Procedure GadgetAbsX(GadgetID)
Protected pos.RECT
GetWindowRect_(GadgetID(GadgetID), @pos)
ProcedureReturn pos\left
EndProcedure
Procedure GadgetAbsY(GadgetID)
Protected pos.RECT
GetWindowRect_(GadgetID(GadgetID), @pos)
ProcedureReturn pos\top
EndProcedure
If OpenWindow(0, 0, 0, 305, 140, "ScrollAreaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
ScrollAreaGadget(0, 10, 10, 290,120, 375, 155, 30)
ButtonGadget (1, 10, 10, 230, 30,"Click me to get my abs. coords")
CloseGadgetList()
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Debug GadgetAbsX(1)
EndSelect
EndSelect
ForEver
EndIf
As you see, this also works also with nested containers.
Is this what you want or do you want this natively?