What element did I clicked on?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/03/2005 at 07:08, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   8.x 
Platform:   Windows  ; Mac  ;  Mac OSX  ; 
Language(s) :   C.O.F.F.E.E  ;

---------
I finaly got the scrolling list of items working (more or less 😉
I populated it with text, using AddStaticText.
Now, how do I get to know in what element the user clicked?
Until now I wrote this:

  
PluginDialog::Message(msg)  
{var dev,chn;  
  
dev = msg->GetData(BFM_INPUT_DEVICE);  
if (dev == BFM_INPUT_MOUSE)  
{  
   chn = msg->GetData(BFM_INPUT_CHANNEL);  
  
   if (chn == BFM_INPUT_MOUSELEFT)  
    {  
        ***WHAT GOES HERE???***  
    }  
   }  
   return super::Message(msg);  
}  

Each static item has its own ID. Is there any way to know what was the clicked static text item?

Rui Batista

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/03/2005 at 07:32, xxxxxxxx wrote:

You can use GeDialog::GetItemHeight() etc. to know where each fieldis. Then you have to check the X/Y position of the event (look in the container) against this for each ID.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/03/2005 at 07:35, xxxxxxxx wrote:

My text is inside a Scroll group. What if I have the scroll slider on another position?

Rui Batista

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/03/2005 at 07:37, xxxxxxxx wrote:

GetVisibleArea()

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/03/2005 at 07:58, xxxxxxxx wrote:

Thank you Mikael. Will give it a try 🙂

Rui Batista

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/03/2005 at 10:27, xxxxxxxx wrote:

Ok, I have this:

  
GetVisibleArea(GROUP_SCROLL,&x;,&y;,&w;,&h;);  
h=GetItemHeight(5000);  
click=msg->GetData(BFM_INPUT_Y);   
selected=ceil((y/h)-(click/h));  

Item with ID 5000 is the Static Text item. They are all the same size. Must I add it any other value? Like, the spacing between group elements?
How can I identify which one was clicked?
Also, when I resize the window down and the scroll group shows a slider, it gets tougher to click on item as the cursor tends to change into a hand, to scroll. Can that be turned off?

Rui Batista

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/03/2005 at 10:32, xxxxxxxx wrote:

When I said etc. I meant the other GetElement...() functions described in the documentation. For example GetElementX().
You might be able to avoid the cursor change by using SetMousePointer(). I haven't tried, so perhaps it doesn't work or flickers. In that case the answer is no.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/03/2005 at 10:41, xxxxxxxx wrote:

"When I said etc. I meant the other GetElement...() functions described in the documentation. For example GetElementX()."

Now you got me, Mikael. I can't find and GetElement... in the docs. I only have Static Text items inside the scroll group. And they are all simple filenames, so they are short (single line strings).

Rui Batista

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/03/2005 at 11:12, xxxxxxxx wrote:

When I said Element, I meant Item... 🙂
Have a look in the docs for GeBaseDialog. You'll find lots of useful functions in there.