Re: How to combine a slider and an edit control in win32lib

new topic     » goto parent     » topic index » view thread      » older message » newer message
penpal0andrew said...

I have a program which has a slider (scroll control) and an edit control. And when I move the slider it adjusts the value shown in the read only edit control. However, I would like it so I can ALSO edit the edit control, and have the slider change. But when I attempted to do them both, it made some sort of infinite event loop. I assume that is what happened.

I am asking this as a general idea, rather than asking someone to fix some code that I have written.

Andy

Assuming Win32lib ...

global procedure Keypress_EB( integer self, integer event, sequence parms ) 
    object val 
    sequence range 
	 
    if parms[1] = VK_RETURN and parms[2] = 0 then 
        -- Get the number typed in to the EditBox (EB) 
        val = getNumber(self) 
 
        -- Get the current range allowed in the scrollbar 
    	range = getScrollRange(HSBar) 
 
        -- Make sure the entered value is in the allowed range. 
    	if val >= range[1] and val <= range[2] then 
 
            -- Set the new position of the 'thumb' 
            setScrollPos(HSBar, val) 
 
        else 
            -- Change the edit box to the current thumb position. 
            setText(self, getScrollPos(HSBar)) 
        end if 
    end if 
end procedure 
setHandler(EB, w32HKeyPress, routine_id("Keypress_EB")) 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu