Detecting Edit Table Scrollbars (OpenInsight 32-bit Specific)
At 24 AUG 2003 11:28:38PM Andrew M Matthews wrote:
Hi All,
Does anyone know if there is a way to detect whether the scrollbars are visible on an edit table? I am not interested in making them visible, just finding out whether they are.
Cheers,
Andrew Matthews
iTMS Software
At 25 AUG 2003 08:56AM Donald Bakke wrote:
Andrew,
Does anyone know if there is a way to detect whether the scrollbars are visible on an edit table?
Try this:
Equ GW_CHILD$ to 5
Equ WS_VSCROLL$ to 2097152; * 0x00200000L
Equ GWL_STYLE$ to -16
hWndEditTbl=Get_Property(Control, "HANDLE")
hWndDataTbl=GetWindow(hWndEditTbl, GW_CHILD$)
SubStyle=GetWindowLong(hWndDataTbl, GWL_STYLE$)
ScrollBarVisible=(BitAnd(SubStyle, WS_VSCROLL$) ] 0)
Credit goes to Carl Pates who helped me with this several years ago. BTW, I have not tested this code in OI32.
At 21 SEP 2003 07:13PM Andrew M Matthews wrote:
Don,
Thanks for the reply. Unfortunately the code you gave me doesn't seem to work in the 32-bit version. This means that I am still at a loss as to how to detect the scrollbars. Hopefully someone else has found a way to do it in both the 16-bit and 32-bit versions.
Cheers,
Andrew
iTMS Software
At 22 SEP 2003 04:39AM Oystein Reigem wrote:
Andrew,
I tried Don's (Carl's) code too. I kept the edit table's default settings, except I toggled the scroll bars. SubStyle seemed to stay at int 1350582772=hex 508041F4. My experiments seem to confirm your results. OI version=4.1.2.
- Oystein -
At 22 SEP 2003 08:42AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Guys,
Things have got a little more complicated with the advent of Win32, with the scrollbars now registering as separate controls that are children of the DataTable control (which is itself a child of the EditTable control!).
Anyway here's some code that I quickly put together that should show you how to drill down and find out what you need:
declare function getWindow, getWindowLong, getClassName equ GWL_STYLE$ to -16 equ GW_HWNDNEXT$ to 2 equ GW_CHILD$ to 5 equ SBS_HORZ$ to 0 equ SBS_VERT$ to 1 equ WS_VISIBLE$ to 0x10000000 control=@window : ".TABLE_1" hWndEditTbl=Get_Property(Control, "HANDLE") hWndDataTbl=GetWindow(hWndEditTbl, GW_CHILD$) isHorizontal=0 isVertical =0 eof=0 hwndChild=getWindow( hWndDataTbl, GW_CHILD$ ) loop if hwndChild then lpClassName=str( \00\, 256 ) call getClassName( hwndChild, lpClassName, 255 ) if ( lpClassName1,\00\ _eqc "ScrollBar" ) then childStyle=getWindowLong(hwndChild, GWL_STYLE$) if bitAnd( childStyle, WS_VISIBLE$ ) then if bitAnd( childStyle, SBS_VERT$ ) then isVertical=1 end else isHorizontal=1 end end end end else eof=1 end until eof hwndChild=getWindow( hwndChild, GW_HWNDNEXT$ ) repeatThe only thing you may have to watch out for is the GetClassName call because it's not defined by default in a clean OI system. To use and prototype it yourself add this line to the DLL_USER32 record in SYSPROCS and then run declare_fcns on it:
INT STDCALL GetClassNameA( HANDLE, LPCHAR, INT ) as GetClassName
World leaders in all things RevSoft