Re: GetColumn problem

Jonathan Pobst <[email protected]>
Newsgroups gmane.comp.gnome.winforms
Message-ID <[email protected]>
According to the docs for TLP.GetColumn ():

---
The column position of the specified child control, or -1 if the 
position of control is determined by LayoutEngine.

To get the actual position of control, even when its position is 
determined by LayoutEngine, call the GetPositionFromControl method.
---

So if you aren't explicitly setting the control's column earlier in 
code, this will return -1.  If you are relying on the TLP to arrange 
them automatically, you need to use TLP.GetPositionFromControl().

Jonathan


PFJ wrote:
> Hi,
> 
> I have a tablelayoutpanel called lesson. This contains a number of rows and
> columns. I have a generic mouseclick event attached to it.
> 
> In the event I want to find the x and y position of the mouse as well as the
> column.
> 
> No problems with the x and y position (MousePosition.x and MousePosition.y
> do the job splendidly), however, I can't seem to get the column number.
> 
> Currently, my code looks like this
> 
> int colno = lesson.GetColumn((Control)sender)); 
> 
> (it has had a pile of different things in the place of Control above).
> 
> When I output colno to a label (for debugging), it always gives  -1
> irrespective of the column clicked. I'm probably really close, but just
> can't quite get it right.
> 
> A little help?
> 
> TTFN
> 
> Paul

_______________________________________________
Mono-winforms-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-winforms-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.