I'm trying to find a way to get the coordinates of the mouse pointer when I left click somewhere in a ScrollAreaGadget().
This may not be the best way to do it. But after extensive searching I'm getting a bit clueless... :roll:
Anyway, here is what I managed to do this far.
Code: Select all
Procedure Max(n1, n2)
If n1 >= n2
max = n1
Else
max = n2
EndIf
ProcedureReturn max
EndProcedure
UseJPEGImageDecoder()
; Load BIG a picture made of 2 parts (left & right)
LoadImage(0, "H:\FondsDePage\bigimage_left.jpg")
img1width.l = ImageWidth()
img1height.l = ImageHeight()
LoadImage(1, "H:\FondsDePage\bigimage_right.jpg")
img2width.l = ImageWidth()
img2height.l = ImageHeight()
; Display the whole thing using a ScrollAreaGadget()
OpenWindow(0, 0, 0, 800, 600, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "Nouveau projet")
CreateGadgetList(WindowID(0))
ScrollAreaGadget(0, 0, 0, 800, 600, img1width + img2width, max(img1height, img2height), 10)
ImageGadget(1, 0, 0, img1width, img1height ,UseImage(0))
ImageGadget(2, img1width, 0, img2width, img2height, UseImage(1))
CloseGadgetList()
; How do I...
; ...find the coordinates (in pixels) of the mouse when somebody clicks somewhere in the image ?
;
Quit.l = 0
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_Event_CloseWindow
Quit = 1
EndIf
Until Quit = 1
End
Thanks for any help or advice.