Hello
I'm getting to know datagrid tables for the first time and have encountered a problem: when I click on the vertical or horizontal scrollbar to go up or down, or left or right, the script for the datagrid group is triggered. Clicking a line of my table successfully takes me to the intended card, populated by the correct data, but clicking on the scrollbars likewise opens the same card with the same data. Could it be a scripting error or the design of my rows? Thanks for any comments.
Monty
Script of Datagrid Group triggered by Click in Scrollbar
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 132
- Joined: Mon Jan 14, 2013 3:37 pm
Re: Script of Datagrid Group triggered by Click in Scrollbar
Hi Monty,
You can use the following code to mask out the datagrid scrollbars:
I hope this helps
- Gerrie
You can use the following code to mask out the datagrid scrollbars:
Code: Select all
on mouseUp pButton
local hScrollClicked, vScrollClicked
if pButton is 1 then
put the clickLoc into tLoc
put (the dgProps["show hscrollbar"] of me) and within(scrollbar 1 of me, tLoc) into hScrollClicked
put (the dgProps["show vscrollbar"] of me) and within(scrollbar 2 of me, tLoc) into vScrollClicked
if not (hScrollClicked or vScrollClicked) then
answer "hey presto"
end if
end if
end mouseUp
- Gerrie
010100000110010101100001011000110110010100111101010011000110111101110110011001010010101101010100011100100111010101110100011010000010101101001010011101010111001101110100011010010110001101100101
Re: Script of Datagrid Group triggered by Click in Scrollbar
Hello Gerrie,
Your script did not work for me, but it gave me an idea that seems to work so far, but maybe it will have unforeseen consequences.
Here's my modification:
Please let me know if you see an error. BTW, the need for this workaround seems like a bug, but it must be idiosyncratic to my environment or others would have reported it.
Monty
Your script did not work for me, but it gave me an idea that seems to work so far, but maybe it will have unforeseen consequences.
Here's my modification:
Code: Select all
put the clickLoc into tLoc
--put (the dgProp["show hscrollbar"] of me) and within(scrollbar 1 of me, tLoc) into hScrollClicked
--put (the dgProp["show vscrollbar"] of me) and within(scrollbar 2 of me, tLoc) into vScrollClicked
put within(scrollbar 2 of me, tLoc) into vScrollClicked
put within(scrollbar 1 of me, tLoc) into hScrollClicked
if vScrollClicked or hScrollClicked then
exit mouseup
else
etc.
Monty
-
- Livecode Opensource Backer
- Posts: 132
- Joined: Mon Jan 14, 2013 3:37 pm
Re: Script of Datagrid Group triggered by Click in Scrollbar
That's great
The part you've commented out also takes the visibility of the datagrid's scrollbars into account, because if not then it would behave as if they were visible even when they're not.
To see what I mean you need to play with the datagrid's "Show hScrollbar" or "Show vScollbar" properties a bit and observe the result.
Gerrie
The part you've commented out also takes the visibility of the datagrid's scrollbars into account, because if not then it would behave as if they were visible even when they're not.
To see what I mean you need to play with the datagrid's "Show hScrollbar" or "Show vScollbar" properties a bit and observe the result.
Gerrie
010100000110010101100001011000110110010100111101010011000110111101110110011001010010101101010100011100100111010101110100011010000010101101001010011101010111001101110100011010010110001101100101