Re: structures, and tabitem right-click hittest

new topic     » goto parent     » topic index » view thread      » older message » newer message

Derek,

Ok, but what version of Win32Lib has W32_allot in it?  I'm using 59.01.

Dan Moyer

----- Original Message ----- 
From: "Derek Parnell" <ddparnell at bigpond.com>
To: <EUforum at topica.com>
Subject: Re: structures, and tabitem right-click hittest


>
>
> ----- Original Message ----- 
> From: "Dan Moyer" <DANIELMOYER at prodigy.net>
> To: "EUPHORIA LIST" <EUforum at topica.com>
> Sent: Saturday, December 06, 2003 9:32 AM
> Subject: structures, and tabitem right-click hittest
>
>
> > Jordah, Derek, Euman, etc:
> >
> > Not knowing what I was doing, I tried to modify Jordah's example2.exw
(using
> > his llrtns.ew), to indicate which tabitem is right-clicked on, with the
> > following tacked on at the end of example2.exw, just before WinMain, but
it
> > doesn't work.  Fails trying to read memory at FFFFFFFF.   (I made
"htFlags"
> > = 0 because it failed at the store without something there as a value,
not
> > for any other reason.)  Relevant structure info(?) is after code.
Without
> > the tabitem hittest part, the mouse rightclick on tab position is
returned
> > just fine.
> >
> > Can anyone make this work right?  It tacks onto end of Jordah's
> > Example2.exw, which can be found with his llrtns.ew low level routines
> > library at:
> >
> > http://www.rapideuphoria.com/llrtns.zip
> >
> > Dan Moyer
> >
> >
> >   -------------------[ POINT STRUCTURE ???]-------------------
> > sequence POINT
> >   POINT = defineStructure({
> >   {"x"  ,C_LONG},
> >   {"y" ,C_LONG}
> >   })
> >
> >
> >   -------------------[ HITTESTINFO STRUCTURE ??? ]------------------- 
> > sequence HITTESTINFOSTRUCT
> >   HITTESTINFOSTRUCT = defineStructure({
> >   {"mousePoint"  , POINT},
> >   {"htFlags"     ,C_UINT}
> >   })
> >
> >
> > function rtClickedTab(atom Tab, integer x, integer y)
> >   Store(HITTESTINFOSTRUCT, {{"mousePoint"  ,{x,y}},{"htFlags", 0}})
> >   junk = sendMessage(Tab, TCM_HITTEST, 0, addressOf(HITTESTINFOSTRUCT))
> >
> > return junk
> > end function
> >
> > ----- mouse handler  -------------
> > procedure Tab_onMouse (integer self, integer event, sequence params)
> > --params is ( int event, int x, int y, int shift )
> > integer aTab
> >
> > if equal(params[1], RIGHT_DOWN) then
> >  setText({status,1}, "right down: " & sprint(params[2]))
> >       aTab = rtClickedTab(Tab, params[2], params[3])
> >       setText({status,2}, sprint(aTab))
> > else
> >     setText(status, " ")
> > end if
> >
> > end procedure
> > setHandler( Tab, w32HMouse, routine_id("Tab_onMouse"))
> >
> >
> Dan,
> I didn't use the structure library you mentioned. Instead I used the one
built into win32lib and got this result, which didn't crash.
>
>
> constant
>     TCHITTESTINFO_ptX       = W32_allot( Long ),
>     TCHITTESTINFO_ptY       = W32_allot( Long ),
>     TCHITTESTINFO_flags     = W32_allot( UInt ),
>     SIZEOF_TCHITTESTINFO    = W32_allotted_size()
>
> function rtClickedTab(atom Tab, integer x, integer y)
>     atom lHT
>     atom lTab
>     atom lRC
>
>     lHT = acquire_mem(0, SIZEOF_TCHITTESTINFO)
>     store(lHT, TCHITTESTINFO_ptX, x)
>     store(lHT, TCHITTESTINFO_ptY, y)
>
>     lTab = sendMessage(Tab, TCM_HITTEST, 0, lHT)
>     lRC = fetch(lHT, TCHITTESTINFO_flags)
>
>     release_mem(lHT)
>     -- Return both the tab index and where inside the tab the mouse is.
>     return {lTab,lRC}
> end function
>
> -- 
> Derek
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu