Re: right click on tabitem (was: Re: BE IDE v0.18.5 on Home Page)

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

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?

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


----- Original Message ----- 
From: "Dan Moyer" <DANIELMOYER at prodigy.net>
To: <EUforum at topica.com>
Sent: Thursday, December 04, 2003 12:30 AM
Subject: right click on tabitem (was: Re: BE IDE v0.18.5 on Home Page)


>
>
> Dan wrote:
>
> > >1. just for "spiffy"ness, could you make right-click on a layer tab
make
> > >that layer the background layer (& maybe work as a toggle, so another
> > >right-click de-selects it as background?) ? that'd be handy.
> >
>
> Judith responded:
> <<snip>>
>
> > ..., TabItem does not receive right click. Tab Control does
> > but then I do not know which "tab" was clicked.
>
> <<snip>>
>
> Judith,
>
> Best I've been able to think of is:
> 1.  the w32HMouse event can return position of a right click;
> 2.  then there's a "TCM_HITTEST"  message which can tell you which if any
> tab item is at a given position, such as the position of the mouse on
right
> click, above.  But I don't know how to *use* that "TCM_HITTEST"  message,
> maybe Derek, Jordah, or someone else can help??  Jordah made a library,
> "llrtns.ew", which uses a similar message to change the text on a tabitem,
> in "Example2.exw", but I couldn't see how to modify it to use
"TCM_HITTEST".
>
> If it helps, Jordah's lib is at:
> http://www.rapideuphoria.com/llrtns.zip
>
> Dan Moyer
>
> -- this shows x position of right click in tabitem, handily ignores all
but
> actual tabs at top:
> procedure TabControl2_onMouse (integer self, integer event, sequence
params)
> --params is ( int event, int x, int y, int shift )
> if equal(params[1], RIGHT_DOWN) then
>  setText(StatusBar8, "right down: " & sprint(params[2]))  -- x position at
> right click
>
> else
>     setText(StatusBar8, " ")
> end if
>
>
>
> 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