Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

determine if mouse down position is on the top of main colum

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
billcch



Joined: 19 Jan 2007
Posts: 44

PostPosted: Sat Feb 24, 2007 1:57 am    Post subject: determine if mouse down position is on the top of main colum Reply with quote

How can I determine if mouse down position is on the top of main column icon. (I have some special context menu provides only for the row icon)
Thanks
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sun Feb 25, 2007 10:36 pm    Post subject: Reply with quote

You can call VirtualTree.GetWidget(x, y) to retrieve the widget under the given mouse position. This will return a CellWidget if the mouse is over a column cell or a RowWidget if the mouse is over any other part of the row (including the row icon). The icon does not have its own widget - it is drawn by the RowWidget so that is as close as you can get. You'd have to calculate the offset yourself based on the row.Level.

A better way may be to create your own custom RowWidget (see the section in help on doing this) and override the OnMouseDown method. The RowWidget class has some internal methods (MainColumnX, IconOffset) that would allow you to determine whether the mouse down position is over the icon. The left position of the icon is given by:

Code:
x = MainColumnX + IconOffset

_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
billcch



Joined: 19 Jan 2007
Posts: 44

PostPosted: Mon Jul 06, 2009 5:41 pm    Post subject: MainColumnX + IconOffset Reply with quote

I upgrade my virtual tree to 3.12.1, since it removed
MainColumnX and IconOffset properties, not sure which is the best way to fix the following code.
Code:
int x = MainColumnX + IconOffset;

Thanks!
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Jul 06, 2009 10:39 pm    Post subject: Reply with quote

These were removed because the CellWidget class is now responsible for drawing the Icon and connections. This overcomes the issue where setting the BackColor or BorderColor for the main column had a different visual effect to other columns. It also greatly simplifies the code.

To handle this you would need create a custom CellWidget instead of RowWidget and in your OnMouseDown method check whether the cell is for the main column like this:

Code:
if (this.Column == RowWidget.MainColumn)
{
    int x = Bounds.X + IconOffset;
}


where x gives you the left position of the icon as before
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
billcch



Joined: 19 Jan 2007
Posts: 44

PostPosted: Tue Jul 07, 2009 2:53 pm    Post subject: Reply with quote

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group