Re: Datagrid: multiple hilites

2009-10-16 Thread Trevor DeVore

On Oct 16, 2009, at 6:58 PM, David Bovill wrote:


command tweet_ToggleHilite

  put the dgControl of me into dataGrid
  if the dgProp ["auto hilite"] of dataGrid is false then
 put the dgLine of me into myIndexNum
 put the dgHilitedIndex of dataGrid into indexNums
 set the wholematches to true
 put itemOffset (myIndexNum, indexNums) into foundItem
 if foundItem = 0 then
if indexNums is empty then
   put myIndexNum into indexNums
else
   put comma & myIndexNum after indexNums
end if
 else -- already hilited
delete item foundItem of indexNums
 end if
 sort numeric items of indexNums

 lock screen
 put the dgControl of me into dataGrid
 put the dgVScroll of dataGrid into someScroll
 set the dgHilitedindex of dataGrid to indexNums
 put indexNums
 set the dgVScroll of dataGrid to someScroll
 unlock screen
  end if
end tweet_ToggleHilite


You are using dgLine with myIndexNum. That should be dgIndex. Does  
that fix the problem?


--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: 
http://revolution.bluemangolearning.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid: multiple hilites

2009-10-17 Thread David Bovill
Thanks Trevor - silly mistake - maybe that will fix my other problem with
scrolling - thanks! The other thing I needed to do was:

set the dgProp ["animate selections"] of dataGrid to false

as otherwise the automatic behavior would scroll to the first selected
record. These "animate" features are new undocumented behaviors right?

2009/10/17 Trevor DeVore 

>
> You are using dgLine with myIndexNum. That should be dgIndex. Does that fix
> the problem?
>
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid: multiple hilites

2009-10-17 Thread David Bovill
Here are some handlers that seem to work "most" of the time. Could be
improved by adding shortcut for fixed height rows, and it seems like the
geometry gets a little messed up in some circumstances (maybe when adding
rows using AddData?) - but it is a start, perhaps the beginning of a feature
request?

command dg_ScrollToIndexTop pIndexNum, pAnimate
>put the dgControl of the target into dataGrid
>if exists(dataGrid) is false then return empty
>put the dg_IndexScrollTop [pIndexNum] of the target into recordTop
>if recordTop is a number then
>   if pAnimate is true then
>  dispatch "StartScrollAnimation" to dataGrid with recordTop
>   else
>  set the dgVScroll of dataGrid to recordTop
>   end if
>end if
>return recordTop
> end dg_ScrollToIndexTop
>
> getprop dg_IndexScrollTop [pIndexNum]
>if pIndexNum = 0 then return 0
>put the dgControl of the target into dataGrid
>if exists(dataGrid) is false then return empty
>if the dgprop ["cache controls"] of dataGrid is false then return empty
>
>put 0 into recordTop
>repeat with someNum = 1 to pIndexNum
>   put the dgRectOfIndex [someNum] of dataGrid into rectOfIndex
>   put item 4 of rectOfIndex - item 2 of rectOfIndex into recordHeight
>   add recordHeight to recordTop
>end repeat
>subtract 3 from recordTop -- just a tweek to show a margin
>return recordTop
> end dg_IndexScrollTop
>
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid: multiple hilites

2009-10-17 Thread Trevor DeVore

On Oct 17, 2009, at 7:06 AM, David Bovill wrote:

Thanks Trevor - silly mistake - maybe that will fix my other problem  
with

scrolling - thanks! The other thing I needed to do was:

set the dgProp ["animate selections"] of dataGrid to false

as otherwise the automatic behavior would scroll to the first selected
record. These "animate" features are new undocumented behaviors right?


Not new. Just undocumented. There is only the one property that just  
animates selection changes.


--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: 
http://revolution.bluemangolearning.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid: multiple hilites

2009-10-17 Thread Trevor DeVore

On Oct 17, 2009, at 9:54 AM, David Bovill wrote:


Here are some handlers that seem to work "most" of the time. Could be
improved by adding shortcut for fixed height rows, and it seems like  
the
geometry gets a little messed up in some circumstances (maybe when  
adding
rows using AddData?) - but it is a start, perhaps the beginning of a  
feature

request?

command dg_ScrollToIndexTop pIndexNum, pAnimate


There are some scrolling handlers that are documented:

ScrollIndexIntoView/ScrollLineIntoView

There is also an undocumented ScrollRectIntoView command you can find  
in the Data Grid button. You might want to take a look at those.


--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: 
http://revolution.bluemangolearning.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid: multiple hilites

2009-10-17 Thread David Bovill
2009/10/17 Trevor DeVore 

>
> There are some scrolling handlers that are documented:
>
> ScrollIndexIntoView/ScrollLineIntoView
>
> There is also an undocumented ScrollRectIntoView command you can find in
> the Data Grid button. You might want to take a look at those.
>

Thanks - but "ScrollRectIntoView" would rely on "## See dgRectOfIndex in
order to get rect of a control in the data grid." - and this is broken for
cases in which the rows are scrolled above the grid (perhaps when they go
above the screens top?) -- see the handler below for a temporary fix.

getprop dg_ScrollTop [lineNum]
>if lineNum < 2 then return 0
>put the dgControl of the target into dataGrid
>if exists(dataGrid) is false then return empty
>
>if the dgprop ["fixed row height"] of dataGrid is true then
>   -- not tested yet!
>   put the the dgprop ["fixed row height"] of dataGrid into
> fixedRowHeight
>   put (lineNum - 1) * fixedRowHeight into scrollTop
>else
>   get the dgVisibleLines of dataGrid
>   put item 1 of it into firstVizLine
>   put item 2 of it into lastVizLine
>
>   switch
>  case lineNum < firstVizLine
> if the dgprop ["cache controls"] of dataGrid is false then
> return empty
> put 0 into scrollTop
> repeat with someLineNum = 1 to lineNum
>put the dgIndexOfLine [someLineNum] of dataGrid into
> someIndexNum
>put the dgRectOfIndex [someIndexNum] of dataGrid into
> rectOfIndex
>put item 4 of rectOfIndex - item 2 of rectOfIndex into
> recordHeight
>add recordHeight to scrollTop
> end repeat
> break
>  default
> put the dgIndexOfLine [lineNum] of dataGrid into indexNum
> put the dgRectOfIndex [indexNum] of dataGrid into rectOfIndex
>
> put item 2 of rectOfIndex into recordTop
> if recordTop is empty then
>-- problem here as the "row" (record view) does not exist so
> cannot get its height!
>return empty
> end if
> put recordTop - the top of dataGrid into scrollTop
>   end switch
>end if
>
>subtract 3 from scrollTop -- just a tweek to show a margin
>return scrollTop
> end dg_ScrollTop
>
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid: multiple hilites

2009-10-17 Thread Trevor DeVore

On Oct 17, 2009, at 11:00 AM, David Bovill wrote:

Thanks - but "ScrollRectIntoView" would rely on "## See  
dgRectOfIndex in
order to get rect of a control in the data grid." - and this is  
broken for
cases in which the rows are scrolled above the grid (perhaps when  
they go

above the screens top?) -- see the handler below for a temporary fix.


Not broken, just designed for Data Grids where controls are cached.  
See the note for dgRectOfIndex in the source. This is one reason why  
it remains undocumented :-)


--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: 
http://revolution.bluemangolearning.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid: multiple hilites

2009-10-17 Thread David Bovill
I checked again Trevor. It makes sense that it does not work in cases where
the controls are not cached - where it is broken is when the controls are
cached but you try to get:

the dgRectOfIndex [1] of dataGrid

and the controls are scrolled heavily, so that the invisible row view would
be above the top of the card. In these cases it does not return the correct
geometry as the invisible row view is limited to the top of the screen and
no its "true" negative y values. These means that if you try to scroll to
the first row it does not work.


2009/10/17 Trevor DeVore 

> On Oct 17, 2009, at 11:00 AM, David Bovill wrote:
>
>  Thanks - but "ScrollRectIntoView" would rely on "## See dgRectOfIndex in
>> order to get rect of a control in the data grid." - and this is broken for
>> cases in which the rows are scrolled above the grid (perhaps when they go
>> above the screens top?) -- see the handler below for a temporary fix.
>>
>
> Not broken, just designed for Data Grids where controls are cached. See the
> note for dgRectOfIndex in the source. This is one reason why it remains
> undocumented :-)
>
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid: multiple hilites

2009-10-20 Thread Trevor DeVore

On Oct 17, 2009, at 7:02 PM, David Bovill wrote:

I checked again Trevor. It makes sense that it does not work in  
cases where
the controls are not cached - where it is broken is when the  
controls are

cached but you try to get:

the dgRectOfIndex [1] of dataGrid

and the controls are scrolled heavily, so that the invisible row  
view would
be above the top of the card. In these cases it does not return the  
correct
geometry as the invisible row view is limited to the top of the  
screen and
no its "true" negative y values. These means that if you try to  
scroll to

the first row it does not work.


I just performed the following test and the dgRectOfIndex[1] returned  
the proper result.


1) Created new Data Grid.
2) Changed style to "form"
3) Turned off fixed row height
4) Turned on "cache controls"
5) Turned off "persistent data"
6) Positioned Data Grid at 0,0

I then added about 50 or so lines to the Data Grid. Here are results:

put the dgRectOfIndex[1] of group 1
0,0,233,21

I then scrolled to the bottom of the Data Grid:

put the dgRectOfIndex[1] of group 1
0,-451,233,-430

I then tried scrolling the first index back into view and it worked:

dispatch "ScrollRectIntoView" to group 1 with the dgRectOfIndex[1] of  
group 1


Just let me know what steps you are taking and what you are seeing. If  
there is a bug that is the only way I can track it down.


--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: 
http://revolution.bluemangolearning.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid: multiple hilites

2009-10-20 Thread David Bovill
Whoa!

So sorry. I really checked this very thoroughly or so I thought. I turns out
not to a datagrid issue, but mine - or should that be a Rev bug??? Goes like
this:

I was relying on a handler I've had for decades
"rect_CreateTransparentButton" which does what is say on the tin, creates a
semi-transparent button at the rect you specify, so you can see the area -
one click an it is gone. OK - but :)

set the rect of transparentButton to someRect
> show transparentButton
>

that's it! That's the problem ??? The script creates the button with "create
invisible button someName", does some stuff, sets the rect and shows the
button - so? Well setting the rect of an invisible object off screen does
not work?!? It gets limited to the screen rect.

OK - it's old code and it would be better to set the templatebutton and then
reset it - but still I can feel good about myself and waisting Trevors time
right? This is surely a Rev bug :)

2009/10/20 Trevor DeVore 

> On Oct 17, 2009, at 7:02 PM, David Bovill wrote:
>
>  I checked again Trevor. It makes sense that it does not work in cases
>> where
>> the controls are not cached - where it is broken is when the controls are
>> cached but you try to get:
>>
>> the dgRectOfIndex [1] of dataGrid
>>
>> and the controls are scrolled heavily, so that the invisible row view
>> would
>> be above the top of the card. In these cases it does not return the
>> correct
>> geometry as the invisible row view is limited to the top of the screen and
>> no its "true" negative y values. These means that if you try to scroll to
>> the first row it does not work.
>>
>
> I just performed the following test and the dgRectOfIndex[1] returned the
> proper result.
>
> 1) Created new Data Grid.
> 2) Changed style to "form"
> 3) Turned off fixed row height
> 4) Turned on "cache controls"
> 5) Turned off "persistent data"
> 6) Positioned Data Grid at 0,0
>
> I then added about 50 or so lines to the Data Grid. Here are results:
>
> put the dgRectOfIndex[1] of group 1
> 0,0,233,21
>
> I then scrolled to the bottom of the Data Grid:
>
> put the dgRectOfIndex[1] of group 1
> 0,-451,233,-430
>
> I then tried scrolling the first index back into view and it worked:
>
> dispatch "ScrollRectIntoView" to group 1 with the dgRectOfIndex[1] of group
> 1
>
> Just let me know what steps you are taking and what you are seeing. If
> there is a bug that is the only way I can track it down.
>
>
> --
> Trevor DeVore
> Blue Mango Learning Systems
> ScreenSteps: http://www.screensteps.com
> Releasable Revolution Resources for Developers:
> http://revolution.bluemangolearning.com
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid: multiple hilites

2009-10-20 Thread Trevor DeVore

On Oct 20, 2009, at 1:18 PM, David Bovill wrote:


Whoa!

So sorry. I really checked this very thoroughly or so I thought. I  
turns out
not to a datagrid issue, but mine - or should that be a Rev bug???  
Goes like

this:

I was relying on a handler I've had for decades
"rect_CreateTransparentButton" which does what is say on the tin,  
creates a
semi-transparent button at the rect you specify, so you can see the  
area -

one click an it is gone. OK - but :)

set the rect of transparentButton to someRect

show transparentButton



that's it! That's the problem ??? The script creates the button with  
"create
invisible button someName", does some stuff, sets the rect and shows  
the
button - so? Well setting the rect of an invisible object off screen  
does

not work?!? It gets limited to the screen rect.

OK - it's old code and it would be better to set the templatebutton  
and then
reset it - but still I can feel good about myself and waisting  
Trevors time

right? This is surely a Rev bug :)


No worries. It was a simple enough test to run and I found and fixed  
an unrelated bug while doing it :-)


--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: 
http://revolution.bluemangolearning.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution