Detecting events in complex grid
Scotte Meredith
spomacguy at gmail.com
Fri Nov 1 12:22:28 EDT 2019
Thanks, Kelly.
> On Nov 1, 2019, at 5:34 AM, Kelly Burgess <kellyb at montana.com> wrote:
>
> Some more of that great Omnis Support -- I've just been alerted to a change in Studio 10.1:
>
> "Note in 10.1 the complex grid now scrolls per pixel, not in 8 pixel increments, so if you keep your calculation in 10, you will need to check for this as you are dividing by 8."
>
> This was in reference to some code I had in an evHScrolled handler to prevent horizontal scrolling beyond the content.
>
> Calculate maxHscroll as (totalContentWidth-($cinst.$objs.cgClientLedger.$width-16))/8
>
> where the -16 removed the scrollbar's width and the /8 converted pixels to $hscroll units. Apparently in Studio 10.1 I'll need to adjust things for 1-pixel scroll units.
>
> Kelly
>
>
>
> On Nov 1, 2019, at 6:12 AM, Kelly Burgess wrote:
>
>> So much for quick tests - I found that if I scrolled the list horizontally the code broke. It needs to compensate by adding $hscroll*8 (scroll units are 8 pixels each) to the pXCoord value passed to getColDivider.
>>
>> getColDivider(pXCoord)
>> ---------------------------------
>> Do $cinst.$objs.cgClientLedger.$dividers.$makelist($ref.$posn) Returns divList
>> Calculate xpos as pXCoord+($cinst.$objs.cgClientLedger.$hscroll*8)
>> For divList.$line from 1 to divList.$linecount step 1
>> If xpos <divList.C1-2
>> Quit method 0
>> Else If xpos >divList.C1+2
>> ;
>> Else
>> Quit method divList.$line
>> End If
>> End For
>> Quit method 0
>>
>>
>> A side effect you may need to deal with is that Omnis keeps the total of the column widths constant. If I have a 14 column list displayed in the grid, and I sum the widths of the column objects to figure out the total content width, that total doesn't change when I grow or shrink column 2. What happens (in Studio 8.1.7 anyway) is that column 14 absorbs the change to column 2 in reverse. If I make column 2 wide enough, column 14's object's width goes negative. The workaround for me was to add a 15th column to the complex grid with nothing in it.
>>
>> Kelly
>>
>>
>> On Nov 1, 2019, at 5:13 AM, Kelly Burgess wrote:
>>
>>> Scotte wrote:
>>>> How do I detect the resizing of a column in a complex grid?
>>>>
>>>> I'm not finding any of the evXXX events that address this. (Studio 8 +)
>>>
>>>
>>> Based on Paul's suggestion, this seems to work in a quick test - Given a kComplexGrid named cgClientLedger with $mouseevents=kTrue --
>>>
>>> cgClientLedger.$event
>>> --------------------------------
>>> On evMouseDown
>>> Do method getColDivider (pMouseX) Returns iDividerDragged
>>> ;
>>> On evMouseUp
>>> If iDividerDragged>0
>>> Send to trace log {cgClientLedger divider [iDividerDragged] was just dragged}
>>> Calculate iDividerDragged as 0
>>> End If
>>>
>>>
>>> getColDivider(pXCoord)
>>> ---------------------------------
>>> Do $cinst.$objs.cgClientLedger.$dividers.$makelist($ref.$posn) Returns divList
>>> For divList.$line from 1 to divList.$linecount step 1
>>> If pXCoord<divList.C1-2
>>> Quit method 0
>>> Else If pXCoord>divList.C1+2
>>> ;
>>> Else
>>> Quit method divList.$line
>>> End If
>>> End For
>>> Quit method 0
>>>
>>>
>>> Kelly
>>
>
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
Scotte Meredith
SpoMacGuy at gmail.com
More information about the omnisdev-en
mailing list