1. 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"))





1.

TCM_HITTEST Message

----

Determines which tab, if any, is at a specified screen position. You can
send this message explicitly or by using the TabCtrl_HitTest macro.

Syntax


To send this message, call the SendMessage function as follows.
lResult = SendMessage(      // returns LRESULT in lResult     (HWND)
hWndControl,      // handle to destination control     (UINT) TCM_HITTEST,
// message ID     (WPARAM) wParam,      // = 0; not used, must be zero
(LPARAM) lParam      // = (LPARAM) (LPTCHITTESTINFO) pinfo; );
Parameters

wParam
Must be zero.
pinfo
Pointer to a TCHITTESTINFO structure that specifies the screen position to
test.
Return Value

Returns the index of the tab, or -1 if no tab is at the specified position.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

2.

TCHITTESTINFO Structure

----

Contains information about a hit test. This structure supersedes the
TC_HITTESTINFO structure.

Syntax

typedef struct tagTCHITTESTINFO {
    POINT pt;
    UINT flags;
} TCHITTESTINFO, *LPTCHITTESTINFO;
Members

pt
Position to hit test, in client coordinates.
flags
Variable that receives the results of a hit test. The tab control sets this
member to one of the following values:
TCHT_NOWHERE
The position is not over a tab.
TCHT_ONITEM
The position is over a tab but not over its icon or its text. For
owner-drawn tab controls, this value is specified if the position is
anywhere over a tab.
TCHT_ONITEMICON
The position is over a tab's icon.
TCHT_ONITEMLABEL
The position is over a tab's text.
TCHT_ONITEM is a bitwise-OR operation on TCHT_ONITEMICON and
TCHT_ONITEMLABEL.

Dan Moyer

new topic     » topic index » view message » categorize

2. Re: structures, and tabitem right-click hittest

----- Original Message ----- 
From: "Dan Moyer" <DANIELMOYER at prodigy.net>
To: "EUPHORIA LIST" <EUforum at topica.com>
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

new topic     » goto parent     » topic index » view message » categorize

3. Re: structures, and tabitem right-click hittest

Thanks Derek, I'll give it a try!

Dan Moyer

>
> >
> > 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
> >
> >

<snip>

>
> 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 message » categorize

4. Re: structures, and tabitem right-click hittest

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 message » categorize

5. Re: structures, and tabitem right-click hittest

Derek,

Appears to work ok if I just use allot rather than W32_allot; is this likely
to cause a problem?  (Tab index returned is 0 referenced, which is fine)

Dan Moyer

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

<snip>


> > >
> > 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!
> >
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

6. Re: structures, and tabitem right-click hittest

----- Original Message ----- 
From: "Dan Moyer" <DANIELMOYER at prodigy.net>
To: <EUforum at topica.com>
Subject: Re: structures, and tabitem right-click hittest


> 
> 
> Derek,
> 
> Appears to work ok if I just use allot rather than W32_allot; is this likely
> to cause a problem?  (Tab index returned is 0 referenced, which is fine)
> 
> Dan Moyer
> 
> >
> > Derek,
> >
> > Ok, but what version of Win32Lib has W32_allot in it?  I'm using 59.01.
> >
> > Dan Moyer
> >

The next one has all the 'generic' named routines prefixed with "W32_". There is
also a w32tk.e which allows the old (current) named routines work as well. This
was done because I was told my names should not be used because they had a high
probability of clashing with names that other might use. So I renamed them all.

I'll build this hit test into the library so that it returns the id of the
TabItem control.

-- 
Derek

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu