MaxGui Slider Ticks

BlitzMax Forums/BlitzMax Programming/MaxGui Slider Ticks

RJJ(Posted 2005) [#1]
I have a slider working fine. However, I am using the SLIDER_TRACKBAR style with a slider range 0 to 100. This means that below the slider I get a solid black line of ticks. Is there any way to remove this?

TIA


Chris C(Posted 2005) [#2]
yeah I was wondering about this too, is there a windows message that can be sent to the gadget perhaps?


RJJ(Posted 2005) [#3]
Interestingly the docs show the windows slider with a tick at each end and the pointer in the middle?


JoshK(Posted 2005) [#4]
Looks like TBS_AUTOTICK will do it:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/trackbar/styles.asp


Chris C(Posted 2005) [#5]
errm thats how it is now! 0-100 range gives a 100 ticks


fredborg(Posted 2005) [#6]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/trackbar/messages/tbm_setticfreq.asp
TBM_SETTICFREQ is what you are looking for


RJJ(Posted 2005) [#7]
OK, Newbie question. I'd like to use TBS_NOTICK, the question is how?


RJJ(Posted 2005) [#8]
>OK, Newbie question. I'd like to use TBS_NOTICK, the
>question is how?

Anyone?


Perturbatio(Posted 2005) [#9]
you need to use the winapi command SendMessage:


?win32
Const TBS_AUTOTICKS = 1
Const TBS_VERT = 2
Const TBS_TOP = 4
Const TBS_BOTH = 8
Const TBS_NOTICKS = 16
Const TBS_ENABLESELRANGE = 32
Const TBS_FIXEDLENGTH = 64
Const TBS_NOTHUMB = 128
Const TBS_TOOLTIPS = 256

Const TBM_SETTICFREQ = 1044


Extern "Win32"
	Function SendMessageA:Int(Hwnd:Int, Msg:Int, WParam:Int, LParam:Int)="SendMessageA@16"
End Extern
?

Global myWin:TGadget = CreateWindow("MYwin", 0,0,500,500)
	Local mySlider:TGadget = CreateSlider(10,10,480,40,myWin,SLIDER_TRACKBAR|SLIDER_HORIZONTAL)
		SetSliderRange(mySlider,1,100)
	Local btnMarks:TGadget = CreateButton("Show Marks", 10,60,80,25,myWin)
	Local btnNoMarks:TGadget = CreateButton("No Marks", 110,60,80,25,myWin)
	

While True
	WaitEvent 
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
		Case EVENT_GADGETACTION
			Select EventSource()
				Case btnMarks
					'btnMarks clicked
					SendMessageA(Query(mySlider, 1), TBM_SETTICFREQ, TBS_AUTOTICKS, Null)
				Case btnNoMarks
					'btnNoMarks clicked
					SendMessageA(Query(mySlider, 1), TBM_SETTICFREQ, TBS_NOTHUMB, Null)
					
			End Select
	End Select
Wend



RJJ(Posted 2005) [#10]
That's great. I can now up the number of ticks on the silder, thanks.

Is there anyway to get rid of the ticks completely?


Perturbatio(Posted 2005) [#11]
Apparently the first and last ticks are created automatically when you create an instance of the control. There doesn't appear to be a way to remove them, although you can get a pointer to the tick array, this array does not contain the first or last ones.


RJJ(Posted 2005) [#12]
Again thanks for the help. In the end I modified the win32slider.cpp to to turn off all ticks for all sliders and rebuild the modules.

RJJ