pgMouseCell PolyGrid

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

pgMouseCell PolyGrid

Post by marksmithhfx » Wed Mar 08, 2023 4:57 pm

Does anyone know how to trigger the pgMouseCell command in the PolyGrid? I am trying to get the current cell position under the mouse cursor as the mouse is hovered over a polyGrid but I am not getting any response to:

Code: Select all

on mouseMove
   put the pgMouseCell of widget "PolyGrid" into fld "MouseCell" -- returns point (col,row)
end mouseMove
which is in the Dictionary.

Thanks
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: pgMouseCell PolyGrid

Post by marksmithhfx » Wed Mar 08, 2023 5:01 pm

I also tried..

Code: Select all

on mouseMove
   get the pgMouseCell of widget "PolyGrid" -- does it go into "it"?
   put it into fld "MouseCell" -- returns point (col,row)
end mouseMove
But that was no better.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

Klaus
Posts: 13866
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: pgMouseCell PolyGrid

Post by Klaus » Wed Mar 08, 2023 5:22 pm

Hi Mark,

just tested here with two example Polygrids and it works as exspected!

Code: Select all

on mousemove
   put the pgMouseCell of widget "PolyGrid1"
end mousemove
Make sure you have the latest version of the widget(s)!

Best

Klaus

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: pgMouseCell PolyGrid

Post by marksmithhfx » Wed Mar 08, 2023 6:01 pm

Klaus wrote:
Wed Mar 08, 2023 5:22 pm

Code: Select all

on mousemove
   put the pgMouseCell of widget "PolyGrid1"
end mousemove
Thanks Klaus. Fooling around I got it to work. But there is at least one requirement and one restriction which makes it challenging for what I was trying to do. I was attempting to drag things from outside the PG into the PG and deposit them in particular columns (or cells). As far as I can tell, the pgMouseCell function does not work on unpopulated (ie. empty) rows. I had to have something in the grid before it worked, and it only worked over the populated rows. 2nd, it doesn't work if the mouse is down outside the PG and then you continue the hovering process inside the PG as you would if you were dragging something in. It works fine if the mouse down is initiated inside the PG. But if the mouse is down BEFORE you start dragging over the PG, there is no response. At least that has been my brief experience (pls let me know if you experience the same). Perhaps there is some other way to do this. I am attempting a drag and drop UI where the user drags SQLite column specs from another table into the PG. I have this working for dragging into LC fields, just not the PG. In general all I really need to know is "where am I" when I deposit the object/bundle into the PG. If I know "where" I am I can figure out how to code the rest (I think). (Of course the next step requires setting the column name from script but I am hoping there is function for doing that... I am still going through the list of options to figure that out).

Cheers,
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: pgMouseCell PolyGrid

Post by marksmithhfx » Wed Mar 08, 2023 7:59 pm

Actually, I think I am over thinking this. The PG is so easy to setup that I don't even think it needs a drag drop interface.

Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”