Slider Disabled but re-enabled when SetSliderValue

Archives Forums/MaxGUI Bug Reports/Slider Disabled but re-enabled when SetSliderValue

degac(Posted 2010) [#1]
SuperStrict
Import maxgui.driverS
Local window:tgadget=CreateWindow("test",10,10,200,200,,WINDOW_TITLEBAR|WINDOW_CENTER)

Local slider:tgadget=	CreateSlider(10,10,180,20,window,SLIDER_HORIZONTAL)
Local label:tgadget=	CreateLabel("...",10,50,180,20,window,LABEL_FRAME)
Local text:tgadget=	CreateTextField(10,90,180,20,window)


DisableGadget label
DisableGadget SLIDER
DisableGadget text


SetSliderValue SLIDER,2
SetGadgetText label,"Something new..."
SetGadgetText text,"Something new..."

Repeat
	WaitEvent()
		Select EventID()
		Case EVENT_APPTERMINATE, EVENT_WINDOWCLOSE
			End
	End Select
Forever


Is this behaviour normal?


degac(Posted 2010) [#2]
Ok, I think I've fixed

Win32 only - win32maxgui.bmx

Type TWindowsSlider Extends TWindowsGadget

Method SetProp(value)
		Desensitize()
		Local tmpEnabled:Int = Not( State() & STATE_DISABLED )

		Select _slidertype
			Case SLIDER_SCROLLBAR
				Local info:SCROLLINFO=New SCROLLINFO
				info.cbSize=SizeOf(SCROLLINFO)
				info.fMask=SIF_POS
				info.nPos=value
				SendMessageW _hwnd,SBM_SETSCROLLINFO,True,Int Byte Ptr info
			Case SLIDER_TRACKBAR
				If _ishorizontal Then
					SendMessageW _hwnd,TBM_SETPOS,True,value
				Else
					'Flip the value so that the scale starts from the bottom
					SendMessageW _hwnd,TBM_SETPOS,True,_visible + _total - value
				EndIf
			Case SLIDER_STEPPER
				SendMessageW _hwnd,UDM_SETPOS,True,value
		End Select
		_value = value
		SetEnabled(tmpEnabled)

		Sensitize()	
	EndMethod