Data Entry with a DataGrid

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Data Entry with a DataGrid

Post by jacque » Fri Oct 30, 2015 5:45 pm

That's a pretty broad generalization. Mac people who do a lot of data entry don't like reaching for the mouse either. Those folks may be more likely to set their system prefs to allow tabbing through all controls. I myself use the keyboard almost exclusively when navigating the file system and file dialogs, and when using menus and managing windows.

I thought spacebar to toggle a checkbox was only a Microsoft thing, I believe all the Office ports support that on Macs, but didn't think it was universal. Since I don't have my Mac set to tab through buttons though I guess I've never had a chance to test it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: Data Entry with a DataGrid

Post by sritcp » Fri Oct 30, 2015 7:56 pm

Hi thims:

1. The problem seems to be with the "rollover" handler and the use of "strLine" variable to capture the displayed line of interest. The weird behavior is not even consistent. Not only the "f" line's checkbox is checked when you hit the spacebar on the "g" line, but if you double-click back to the first column of the "g" line and tab back to the second column and press the space bar, now the "e" line's checkbox is checked, and so on. That is, the count seems to go back. I couldn't figure out how or why.

2. The problem is solved, though, by the use of the (much simpler) ColumnControlOfIndex function to nail down the line you want. This way, you don't need the "rollover" function or "strLine" variable. Just the following code instead:

Code: Select all

dispatch function "ColumnControlOfIndex" to group "Datagrid 1" of stack "WithCheckbox" with "Col 2", tIndex
put the result into tR
send "focus on btn 1 of me" to tR
{Note: In the attached file, I have made a typo in the script; used "focus of btn 1" instead of "focus on btn 1"; but LiveCode doesn't seem to mind. Very forgiving!}

Regards,
Sri
Attachments
WithCheckbox(Sri).livecode.zip
(6.52 KiB) Downloaded 238 times

thims
Posts: 17
Joined: Tue Jun 09, 2015 11:42 pm

Re: Data Entry with a DataGrid {Solved}

Post by thims » Fri Oct 30, 2015 10:50 pm

sritcp:
Thank you so much. That solved my problem perfectly. I just knew it was something I was doing wrong. DataGrids are a godsend, but yes, as everybody knows, very complex and obtuse beasts. I'm sure I will be using ColumnControlOfIndex a lot in the future. I have much to learn still. Adjusting from a lifetime of procedural programming takes time.

Thanks also to all who replied and helped.

Things I learned:
1: When you need to address a particular column of a DataGrid use ColumnControlOfIndex not it's name and if your fudging the row number into it's name your almost certain to be making a mistake.
2: Macs behave differently than PCs in subtle but distinct ways. And jacque: I will not expect or force all platforms to look and behave identically, I will allow each to do what comes naturally to it and it's users.
3: The LiveCode community is fantastic and makes a world of difference.
4: I love LiveCode more today than I did yesterday, if that's even possible.

thims

Post Reply