Resize Edit field with scrollbar
My edit field is resizeable (tied to a window) and is styled. The challenge is to find the number of visible lines in the field, and then set the 5ht parameter in SCROLL BUTTON accordingly within a _wndRefresh event.
I had the same problem (my page scroll was fixed to 16 lines, I don't know why), so every time I resize a window I call this function, I think you can drop it as is in your code, and call it every _wndRefresh event:
CLEAR LOCAL MODE LOCAL FN adjustScroll(id) 'fixes the page scroll teHndle1& = TEHANDLE(id) 'get handle to edit field LONG IF teHndle1& CALL TECALTEXT(teHndle1&) fontH% = FN TEGETHEIGHT (1,1,teHndle1&) efTop% = teHndle1&..teViewRect.top% efBottom% = teHndle1&..teViewRect.bottom% efVisLines%=((efBottom%-efTop%)/fontH%)-1 SCROLL BUTTON -id,,,,efVisLines%,,_scrollOther END IF END FNSomeone will correct me if I am wrong, but when I have fiddled with scrollbars, I could never get them to change size when doing a window refresh. I had to write my own code to handle the Window Grow and resize before the refresh.
I resize my windows with both methods (standard window grow box and "hand-made" FN windowGrow) and always resize the edit field and its scrollbar with the attached function. FN ResizeField is called in the _wndSized event for standard windows, and directly inside FN windowGrow for the custom ones.
CLEAR LOCAL MODE LOCAL FN ResizeField w=WINDOW(_width)-15 h=WINDOW(_height)-15 EDIT FIELD -1,,(4,79)-(w-5,h-4), SCROLL BUTTON -1,,,,,(w-5,78)-(w+11,h-3),_scrollOther FN adjustScroll(1) END FN