DataGrid question...

Niggemann, Bernd Bernd.Niggemann at uni-wh.de
Wed Apr 1 11:58:32 EDT 2020


Hello Mike,

I cannot reproduce the scrolling nor the failing of reporting.

What I did notice is when I changed the size of the field via the mouse in editMode at times switching back to browse mode via command-option-tab the field did not focus when clicking on it and it did not report anything. Apparently because it is not focused.

Make sure the field is focused by e.g. clicking on the card after resizing and then the field.
But there is nothing in the code that I can see that would take focus away from the field, nor does the code trigger scrolling.

Kind regards
Bernd



Mike Doub via use-livecode<https://www.mail-archive.com/search?l=use-livecode@lists.runrev.com&q=from:%22Mike+Doub+via+use%5C-livecode%22> Wed, 01 Apr 2020 08:07:17 -0700<https://www.mail-archive.com/search?l=use-livecode@lists.runrev.com&q=date:20200401>

There is an interesting interaction between the scrolling function, the size of
the field, mouseUp or Down.  For my test, when I click the 6th column,
scrolling occurs and the function returns nothing.  If I size the field such
that no scrolling occurs, all works as expected.   If I change the mouseUp to
mouseDown, all works as expected.   I have not spent the time to figure out
what is going on, but these are my observations.

-= Mike

On Apr 1, 2020, 9:29 AM -0400, Niggemann, Bernd via use-livecode
<use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>>, wrote:
> This is a modification of Jaque's script to get the row and column of a
> locked tableField when the user clicks in a cell.
>
> Use tableField whose lockText is true. Set its script to
>
>
> ------------------------------------------------------------------------------------
> on mouseUp
> put "Row:" && word 2 of the clickline into tRow
> put "Col:" && getColumn(the clickH) into tColumn
> set the itemDelimiter to tab
> put tRow &cr& tColumn & cr & "ClickH: " & the clickH into field "fRes"
> end mouseUp
>
> function getColumn pClickH
> put the tabstops of me into tTabs
> put the num of items in tTabs into tNumStops
> if tNumStops > 1 then
> put last item of tTabs - item -2 of tTabs into tTabWidth
> else
> put item 1 of tTabs into tTabWidth
> end if
> set the itemdel to tab
> put the num of items in line 1 of me into tColumns
> if tNumStops < tColumns then -- add missing tabstops
> repeat with x = tNumStops+1 to tColumns
> put comma & (tTabWidth * x) after tTabs
> end repeat
> end if
> set the itemdel to comma
> put the hScroll of me into tHScroll
> put the borderwidth of me into tBrdr -- tested from 0 to 4
> put the leftMargin of me - 3 into tLeftMarg -- tested from 4 to 12
> put the left of me + tBrdr into tLeftAndBorder
> put tLeftAndBorder - tHScroll - tLeftMarg into tLeftOfItem
> put tLeftAndBorder - tHScroll + tLeftMarg + 1 into tRightOfItem -- + 1 is a
> fudge
> put 0 & comma before tTabs
> repeat with x = 1 to the num of items in tTabs
> if pClickH > (item x of tTabs) + tLeftOfItem and \
> pClickH < (item x+1 of tTabs) + tRightOfItem then
> return x
> end if
> end repeat
> return empty
> end getColumn
> ------------------------------------------------------------------------------------
>
>
> In my testing it works for changed borderWidth and margins, hscrolls and
> vScrolls
>
> If you want to test it take a regular field, set its name to "tf", set its
> script to above script
>
> and from a button apply this
>
>
> -------------------------------------------------------------------------
> on mouseUp
> put "1,2,3,4,5,6" into tLine
> put empty into field "tf"
> replace comma with tab in tLine
> set the itemDelimiter to tab
> repeat 6
> put tLine & cr after tCollect
> repeat with i = 1 to 6
> add 6 to item i of tLine
> end repeat
> end repeat
> delete last char of tCollect
> lock screen
> put tCollect into field "tf"
> set the hGrid of field "tf" to true
> set the vGrid of field "tf" to true
> set the hScrollbar of field "tf" to true
> set the tabStops of field "tf" to 77
> set the lockText of field "tf" to true
> unlock screen
> end mouseUp
>
> -------------------------------------------------------------------------




More information about the use-livecode mailing list