Hi All!
I have used this method in the past to turn off certain window styles and
it has worked great for me. But for some reason I can't seem to
turn off the Horizontal and Vertical ScrollBars on a TreeView window.
Here is how I created the a very simple TreeView, note I did not specifiy
that %WS_HSCROLL or %WS_VSCROLL styles when I created it.
When the control is created with the tree fully expanded but not in view, the
scroll bars automatically come on. I would like to temporarly turn
this off. Is there a TVS_AUTOHSCROLL/TVS_AUTOVSCROLL style not documented?
How would I do this?
Thanks for any suggestions/help!
Regards, Jules
I have used this method in the past to turn off certain window styles and
it has worked great for me. But for some reason I can't seem to
turn off the Horizontal and Vertical ScrollBars on a TreeView window.
Here is how I created the a very simple TreeView, note I did not specifiy
that %WS_HSCROLL or %WS_VSCROLL styles when I created it.
Code:
FUNCTION CreateNewTreeView(ByVal hWnd AS LONG, rc AS RECT) AS LONG LOCAL hWndNew AS LONG '---TreeView LOCAL tvs AS TV_INSERTSTRUCT LOCAL tvi AS TV_ITEM LOCAL hTreeWnd() AS LONG LOCAL sText AS STRING '--- 'Create the TreeView control hWndNew = CreateWindowEx(%WS_EX_CLIENTEDGE ,"SysTreeView32","", _ %WS_CHILD OR %WS_VISIBLE OR %WS_CLIPSIBLINGS _ OR %TVS_HASBUTTONS OR %TVS_HASLINES _ OR %TVS_LINESATROOT OR %TVS_SHOWSELALWAYS, _ rc.nLeft, _ rc.nTop, _ rc.nRight - rc.nLeft, _ rc.nBottom - rc.nTop, _ hWnd,ByVal %NULL,ghInst,ByVal %Null) 'Initialize the tree List tvs.hInsertAfter = %TVI_LAST tvi.mask = %TVIF_TEXT REDIM hTreeWnd(0 To 4) sText = "One" tvi.pszText = StrPtr(sText) tvs.hParent = %TVI_ROOT tvs.item = tvi hTreeWnd(0) = TreeView_InsertItem(hWndNew,tvs) sText = "Two" tvi.pszText = StrPtr(sText) tvs.hParent = hTreeWnd(0) tvs.item = tvi hTreeWnd(1) = TreeView_InsertItem(hWndNew,tvs) sText = "Buckle" tvi.pszText = StrPtr(sText) tvs.hParent = hTreeWnd(1) tvs.item = tvi hTreeWnd(2) = TreeView_InsertItem(hWndNew,tvs) sText = "My" tvi.pszText = StrPtr(sText) tvs.hParent = hTreeWnd(2) tvs.item = tvi hTreeWnd(3) = TreeView_InsertItem(hWndNew,tvs) sText = "Shoe" tvi.pszText = StrPtr(sText) tvs.hParent = hTreeWnd(2) tvs.item = tvi hTreeWnd(4) = TreeView_InsertItem(hWndNew,tvs) 'Expand All For i& = 0 to 4 Call TreeView_Expand( hWndNew, hTreeWnd(i&), %TVE_EXPAND ) Next 'SubClass the control Call SetWindowLong(hWndNew,%GWL_WNDPROC,ByVal CodePtr(ControlSubClassProc)) 'Get rid of the scroll bars temporarly Oldstyle& = GetWindowLong( hWndNew,%GWL_STYLE ) Newstyle& = Oldstyle& XOR %WS_VSCROLL XOR %WS_HSCROLL Call SetWindowLong( hWndNew, %GWL_STYLE , Newstyle&) FUNCTION = hWndNew END FUNCTION
scroll bars automatically come on. I would like to temporarly turn
this off. Is there a TVS_AUTOHSCROLL/TVS_AUTOVSCROLL style not documented?
How would I do this?
Thanks for any suggestions/help!
Regards, Jules
Comment