Behavior : How to detect a click on an empty datagrid space ?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Behavior : How to detect a click on an empty datagrid space ?

Post by liveme » Mon Mar 15, 2021 12:33 pm

Hi Y'all !

How would one "detect a click" on an empty sub-DGrid so as to open a dialog ?
-Sub-Grid content list all Descriptions related to the Main Grid list of existing records.

... if there are no description corresponding to a specific record, than grids remains empty :

Any time this is the case,
-> I would like to let the user click on the empty blank space and popup a message offering him to create a new record :idea:

..so first, I would need to detect a click anywhere on the blank sub-grid space...is that doable ?
Or any other way.
Thanks !

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9663
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Behavior : How to detect a click on an empty datagrid space ?

Post by dunbarx » Mon Mar 15, 2021 2:12 pm

Hi.

Several messages are send when you click into a "blank" area of a DG, "mouseDown", "dgMouseDown", "mouseUp", to mention a few.

You might use the clickLoc to determine "where" the user, er, clicked, and knowing the physical attributes of the DG itself, also know which empty "cell" was clicked in.

Craig

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: Behavior : How to detect a click on an empty datagrid space ?

Post by liveme » Mon Mar 15, 2021 8:21 pm

Hi Craig,

Dahhh...it keeps frustrating me how simple LC can be to go straight to the point most of the time ! :shock:
- still a long way to TS (Think Simple)
finally..came out with the wanted code :

Code: Select all

on mouseUp pButtonNumber
   put the dgdata of grp "DGDetail" into tData
   if tData is empty then   
      answer "Description is empty"
   else
      answer "Description is not empty"
   end if
end mouseUp
Thanks again :idea:

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”