Re: caret cursor in a window
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Jan 15, 2000
- 479 views
Judith, I'm not sure if this is what you mean? It's just a vert. scroll bar control added into a more nearly original example of how to use the caret cursor that Greg Harris sent to me. Note that in order to use "OldBlinkRate" to reset the original "system" blink rate, a SetCaretBlinkTime should probably be in an onClose the window instead of in onLostFocus. Thanks again to Greg for the example code! It's not obvious in this simple window, but his original example code as represented here will do what my earlier "improved" version would not, namely function in a child window that might be "closed" & then re-opened. Dan Moyer ------------- code starts ------------------ -- code generated by Win32Lib IDE v0.8 -- note: "caret" based cursor added in afterward include Win32Lib.ew without warning ---------------------------------------------------------------------------- ---- -- Window Window1 global constant Window1 = create( Window, "The Window", 0, Default, Default, 350, 250+ 19, 0 ) global constant VScroll1 = create( VScroll, "VScroll1", Window1, 257, 37, 20, 150, 0 ) ---------------------------------------------------------------------------- -- "caret" based cursor: integer OldBlinkRate -- to restore original system blink rate OldBlinkRate = c_func(xGetCaretBlinkTime,{}) procedure Window1GetFocus() atom MyCursor atom result MyCursor = getHandle(getSelf())-- could probably be getHandle(Window1) result = c_func( xCreateCaret,{MyCursor,NULL,2,20})-- null is for bmp? result = c_func( xSetCaretBlinkTime,{300}) result = c_func( xSetCaretPos,{100,25})-- use this to control cursor position result = c_func( xShowCaret,{MyCursor}) end procedure onGotFocus[Window1] = routine_id("Window1GetFocus") ---------------------------------------------------------------------- procedure Window1LostFocus() atom result result = c_func( xSetCaretBlinkTime,{OldBlinkRate}) result = c_func( xDestroyCaret,{}) end procedure onLostFocus[Window1] = routine_id("Window1LostFocus") ---------------------------------------------------------------------- WinMain( Window1, Normal ) ------------------ code ends ---------------------- -----Original Message----- From: Judith Evans <camping at FLASH.NET> To: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU> Date: Saturday, January 15, 2000 2:23 AM Subject: Re: caret cursor in a window >Dan, > >If you can get the caret to work in a window with a control such as the >vertical scrollbar, I would appreciate seeing the code. I had played around >with the caret back when David had the routines in Win32lib but could never >get them to work except in a bare window with no controls. Since we do not >yet have WINDOW scrollbars, it didn't do me a whole lot of good! > >Thanks, >Judith Evans