On 3/5/10 9:48 AM, John wrote: > On Friday 05 March 2010 09:15:38 am Paul McNett wrote: >> On 3/5/10 9:05 AM, Larry wrote: >>> On 3/5/2010 11:52 AM, Paul McNett wrote: >>>> On 3/5/10 8:46 AM, Larry wrote: >>>>> We want to bind a control's position to a column in a grid for a grid >>>>> column total. What property do we need to be looking at? >>>> >>>> What do you intend to do if the user horizontally scrolls the grid in >>>> such a fashion as to make the column invisible? >>> >>> I'm planning to also bind to it's width >> >> Look in dGrid.py, lines 642 - 660 (or search for comment "Thanks Roger >> Binns"). That's the code to get the header rect for painting the column's >> header. The meat of the code finds the left position of the column on >> screen, accounting for the horizontal scrollbar. >> >> If a read-only dColumn.Left property seems desirable, based on this code, >> let me know. Otherwise take the code and modify it to your needs. >> >> Paul > > I was able to discover the left by just added all the column widths. But what > Larry has discovered is an issue in my mind. We are using sizers for the > panel (there are multiple panels with multiple tabs). We add each object to > a vertical sizer for each panel. However, for this one item ( the textbox > that follows the location of the last column on a grid) we don't explictly > add the textbox to the panels sizer. But instead add it to the form > (self.Form.paidlbl = dabo.ui.dTextBox(self, DynamicPosition=self.pdlblpos, > DynamicWidth = self.pdlblwidth). For some reason (unknown to me) the textbox > appears at the correct location.
Explain what you mean by "tabs", with regard to panels. When I think of a "tab", I think of a page in a pageframe. The textbox will appear where you position it, if it isn't in a sizer. Since you instantiated it last, it appears on top of the other objects. > I would have thought that the textbox would have appeared on all tabs (because > we appear to be adding it to the form and not the panel). You added it to the form, not to all panels of the form. So it appears on the form, on top of the panels. > Also in general, > just adding an object using position on a form that uses sizers seems wrong. You are bound to be fighting with it, yes. But there's nothing "illegal" about it. > Are we going the wrong way with this? What you should probably do is put the textbox in its own panel, where the panel is in a sizer and sized to grow horizontally with the grid (the grid and this panel are in the same sizer). Then if you need to specify an absolute position and size for the text box, add the text box to that panel but not to the panel's sizer. That way you only need to deal with the position of the textbox within an area that you already know won't be overlapping other controls, and the tb.Left will be equal to the gridcol.Left that you figured out already. Paul _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/[email protected]
