remove Scrollbar in wxListBox, wxTreeCtrl?

BlitzMax Forums/Brucey's Modules/remove Scrollbar in wxListBox, wxTreeCtrl?

MOBii(Posted 2016) [#1]
How can I remove the Scrollbar permanent in wxListBox and in wxTreeCtrl?

TreeFiles has a HORIZONTAL Scrollbar That I can't remove so I set height to +18: so the Scrollbar is hidden:
TreeFiles.SetSize(_s+2, _h+20) ' my cheating...
(You can still see the Scrollbar in TreeFiles if you drag the splitter)
GoToLua works but if I step in the wxListBox sometime the Scrollbar just must draw itself and make a Scrollbar flickering
' --------------------------------------------------------------------------[the Creation]---
GoToLua = New wxListBox.Create(FunctionPanel, 32763, Null, 200, 2000)
TreeFiles = New wxTreeCtrl.Create(FilePanel, 32762, 0, 0, -1, -1, 0) ' wxTR_DEFAULT_STYLE | wxNO_BORDER | wxTR_HAS_BUTTONS

' -----------------------------------------------------------------[the wxListBox Connect]---
GoToLua.ConnectAny(wxEVT_COMMAND_LISTBOX_SELECTED, GoToLuaFunction)
GoToLua.ConnectAny(wxEVT_PAINT, Cancel_GoToLuaFunction)					' This is Cheating, but the only way I can remove the Scrollbar!


' -----------------------------------------------------------------[the Connect Functions]---
Function Cancel_GoToLuaFunction(_event:wxEvent)
	MFrame.GoToLua.SetScrollbar(wxBOTH, 0, 0, 0)
	_event.Skip()
End Function	' /Cancel_GoToLuaFunction

Function GoToLuaFunction(_event:wxEvent)
	MFrame.DoGoToLuaFunction()
	MFrame.GoToLua.SetScrollbar(wxBOTH, 0, 0, 0)
	_event.Skip()
End Function	' /GoToLuaFunction
What I been testing:
'		GoToLua.SetSize(_mw-_s-4, _h)
'		GoToLua.setMinSize(_mw-_s-4, _h)
'		GoToLua.setMaxSize(_mw-_s-4, _h)
'		GoToLua.SetVirtualSize(0, 0)

'		TreeFiles.SetDimensions(0, 0, _s, _h)
'		TreeFiles.setMinSize(_s+2, _h+2)
'		TreeFiles.setMaxSize(_s+2, _h+2)

'		GoToLua.refresh()
'		TreeFiles.SetScrollbar(wxBOTH, 0, 0, 0)
Rem
		GoToLua.SetScrollPos(wxBOTH, 0)
		GoToLua.SetVirtualSize(0,0)
'		GoToLua.ScrollWindowRect(_mw-_s-4, _h+2)
		GoToLua.SetInitialSize(_mw-_s-4, _h+2)
		GoToLua.ScrollLines(0)
End Rem



Henri(Posted 2016) [#2]
Hi,

I believe there is no wx standard way of removing scrollbars by default. Can you post a smallest runable example displaying the problem ? Maybe there is a another solution.

-Henri


MOBii(Posted 2016) [#3]
Was my thinking too when I go thru all the subfunctions
I am to lazy to make a runable copy,


I was thinking I fix the flickering somehow but the application was started in full screen = no flickering
I only get the flickering when I start the application and the list is longer than the GoToLua height
I step thru the wxListBox with menu keyboard shortcuts
GoToLua.ConnectAny(wxEVT_PAINT, Cancel_GoToLuaFunction)				' Call function 2, 3 time every time I press a directional key, every 5 keypress I get the flickering (I ended up with this)
GoToLua.ConnectAny(wxEVT_UPDATE_UI, Cancel_GoToLuaFunction)			' No flickering, but update like 20 time or more a second!
GoToLua.ConnectAny(wxEVT_NC_PAINT, Cancel_GoToLuaFunction)			' Not working!
My thinking is that I could find the right GoToLua.ConnectAny so I could ignore the Scrollbar update!

I was hoping that it was a way to remove the Scrollbar, but I drop this for now, Thank thee anyhow Henri


Brucey(Posted 2016) [#4]
If it is just because you are populating it at the start, couldn't you Freeze() it whilst populating, and then Thaw() it when you are finished?


MOBii(Posted 2016) [#5]
This didn't work:
Case Menu_FunctionPrevious;	If MOBii_AUTORun Then Return	' [Ctrl-PageUp]
				GoToLua.SetScrollbar(wxBOTH, 0, 0, 0)
				GoToLua.Freeze()
				DoGoToLuaFunction(-1)
				GoToLua.Thaw()
So I try make a wxTimer,
In my testing with the timer I GoToLua.Freeze() and somehow the Scrollbar show up before I GoToLua.Thaw()
the Scrollbar was immune to the GoToLua.Freeze()

In the end I figure out that Scrollbar show up when wxEVT_KEY_UP
So execute: GoToLua.SetScrollbar(wxBOTH, 0, 0, 0) when wxEVT_KEY_UP			' This only execute ones compare to GoToLua.ConnectAny(wxEVT_PAINT, Cancel_GoToLuaFunction)
is equal in flickering as
GoToLua.ConnectAny(wxEVT_PAINT, Cancel_GoToLuaFunction)					' Call function 2, 3 time every time I press a directional key, every 5 keypress I get the flickering


Still flickering but less calling code, I am ok with that!


MOBii(Posted 2016) [#6]
I notice when the wxListBox is automatic scrolling, the Scrollbar is drawn on the wxListBox!
If I start the application and the list is longer than the wxListBox height it start autoscroll

It look like the automatic scrolling is the one creating the Scrollbar!

it start scroll when I am on the 7 listitem not the last listitem as normal
Can I stop the automatic scroll on the wxListBox?


MOBii(Posted 2016) [#7]
I could not find any way to turn of the automatic scroll on the wxListBox!

So I cheated as usual
I worked hard to get the wxListBox Border, but it doesn't look good while dragging the spiltter, so I remove the border!
When I remove the border I could make the listbox +17 wider and put the Scrollbar outside the viewing area
The good news is that it is no flickering now
' --------------------------------------------------------------------------[the Creation]---
GoToLua = New wxListBox.Create(FunctionPanel, 32763, Null, 200, 2000, -1, -1, wxBORDER_NONE)

' ----------------------------------------------------------------------------[the Update]---
GoToLua.SetDimensions(0, 0, _mw-_s+18, _h, 1)		' +18 = set Scrollbar outside the Splitter
and I remove all:
GoToLua.SetScrollbar(wxBOTH, 0, 0, 0)


Who say cheating is not paying off?
I try teach my daughter how to cheat in life but mama is not happy about that!