$setrowheight in ComplexGrid in v10.2
Ah, that looks great.
Thank you Kelly.
Mike
On 5 Mar 2021, at 04:35, Kelly Burgess <kellyb@montana.com<mailto:kellyb@montana.com>> wrote:
Hi Mike,
I’m just fooling with a complex grid containing a kMultilineEntry field with its $mouseevents enabled and the following $event code –
#
On evMouseEnter
Calculate iHoverLine as mouseover(kMLine)
Calculate iHoverHeight as $cinst.$textHeight($cfield,iHoverLine)
Do $cinst.$objs.cgTest.$setrowheight(kGridRowSizeToggle,iHoverLine,iHoverHeight,kAnimationCurveEaseIn,100)
#
On evMouseLeave
Do $cinst.$objs.cgTest.$setrowheight(kGridRowSizeToggle,iHoverLine,iHoverHeight,kAnimationCurveEaseIn,100)
The window’s $textHeight method is –
#
Calculate fieldText as iWeatherForecast.[pLine].desc ## contents of field under mouse
Calculate fieldWidth as pMultilineObj.$width
Calculate stringWidth as FontOps.$wintextwidth(fieldText,pMultilineObj.$font,pMultilineObj.$fontsize,pMultilineObj.$fontstyle)
Calculate charHeight as FontOps.$wintextheight(pMultilineObj.$font,pMultilineObj.$fontsize,pMultilineObj.$fontstyle)
Calculate fieldHeight as ((stringWidth/fieldWidth)+1)*charHeight ## adding a line because wordwrap matters
Quit method fieldHeight
The grid has a $rowheight of 20 and I set the multline field’s height to 200.
Seems to work OK. A nice enhancement request might be for the FontOps.$wintextheight() method to accept two more optional parameters – a string of text and the pixel width of the display area – so it could then return a pixel height accounting for wordwrap within the display width. Or is there already a function that does height measurement of wordwrapped text that I can’t recall? I may just be remembering an OS API, not an Omnis function.
Kelly
_____________________________________________________________
Manage your list subscriptions at linkprotect.cudasvc.com/url?a=http%3a%2f%2flists.omnis-dev.com&c=E,1,zoVl6lbqkmhLodzlPmdIU6dQfa-DivEI1XOAE8P9NvzMFnSABErW_1FKYVuBSEpSw9gxC3MeQCneoj2JJSr1oXCTDGqgn_w4uCDzW5CGP80RJ427_MGO-Sc,&typo=1
Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com
_____________________________________________________________
Manage your list subscriptions at lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com