Column-Component like in a wxListCtrl without list Topic is solved
-
- I live to help wx-kind
- Posts: 192
- Joined: Fri Dec 22, 2006 9:17 am
- Location: Germany
- Contact:
Column-Component like in a wxListCtrl without list
Hi!
I'm trying to write a component with consists of columns like in a wxListCtrl but only the header (with other bg-coloring). I created the Columns by deriving it from wxPanel and add the separator for resizing to the right. It works. I only need help on sizing. If the mouse is over the separator the resizing-cursor should appear. On mouse-down with dragging the Panel (Column-Header), the panel should resize.
Has somebody a piece a code or some tips?
Thank you very much.
I'm trying to write a component with consists of columns like in a wxListCtrl but only the header (with other bg-coloring). I created the Columns by deriving it from wxPanel and add the separator for resizing to the right. It works. I only need help on sizing. If the mouse is over the separator the resizing-cursor should appear. On mouse-down with dragging the Panel (Column-Header), the panel should resize.
Has somebody a piece a code or some tips?
Thank you very much.
Code: Select all
and add the separator for resizing to the right
I never used it, but this class seems appropriate : http://docs.wxwidgets.org/stable/wx_wxsashwindow.html
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows
-
- I live to help wx-kind
- Posts: 192
- Joined: Fri Dec 22, 2006 9:17 am
- Location: Germany
- Contact:
About panel, you could probably* catch the mouse pressed event, capture the mouse, then receive all mouse motion events and move the panel along. This is a somewhat similar example : http://wiki.wxwidgets.org/Dragging_a_wxWindow_around
I have no idea of how it'd go with a sash window, never used this class
* never tried it
I have no idea of how it'd go with a sash window, never used this class
* never tried it
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows
-
- I live to help wx-kind
- Posts: 192
- Joined: Fri Dec 22, 2006 9:17 am
- Location: Germany
- Contact:
Hi!
Dragging a window around is no problem and not actual the problem. I've had problems with dragging before. The problem is how to resize each if they are in a row like in a wxListCtrl...manual resizing....how to calculate the new size by mouse position and the new position of the follwoing wxPanel and so on..
But thank you very much.
Any ideas out there ?
Dragging a window around is no problem and not actual the problem. I've had problems with dragging before. The problem is how to resize each if they are in a row like in a wxListCtrl...manual resizing....how to calculate the new size by mouse position and the new position of the follwoing wxPanel and so on..
But thank you very much.
Any ideas out there ?
Hmm, well maybe if the resize panel is moved by e.g. 5 pixels to the right, enlarge the panel it's tied to by 5 pixels too. You could also get the coord of the resize panel, and resize the other panel so that its edge reaches this coord.
Maybe instead of using panels you could just draw it all on a DC (depends what you want of course)
Maybe instead of using panels you could just draw it all on a DC (depends what you want of course)
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows
Hi,
Maybe I misunderstand what you want, but you seem to be trying to re-invent http://docs.wxwidgets.org/trunk/classwx ... _ctrl.html
Regards,
David
Maybe I misunderstand what you want, but you seem to be trying to re-invent http://docs.wxwidgets.org/trunk/classwx ... _ctrl.html
Regards,
David
-
- I live to help wx-kind
- Posts: 192
- Joined: Fri Dec 22, 2006 9:17 am
- Location: Germany
- Contact:
- tierra
- Site Admin
- Posts: 1355
- Joined: Sun Aug 29, 2004 7:14 pm
- Location: Salt Lake City, Utah, USA
- Contact:
Probably the easiest route to take would be to code up a custom drawn window that only consists of the column summaries, and tie in event handlers into a wxGrid, wxListCtrl or wxDataViewCtrl (whichever works best for you) for when column sizes change, and update that window accordingly.
This would simplify the task immensely compared with writing up your own custom list control.
This would simplify the task immensely compared with writing up your own custom list control.
I wrote my own header control too.
In my case it is one simple window. I don't use distinct windows for every column, nor are the separators own windows.
It is way to simple to check if the mouse is over a column (wich can be dragged around too in my control, to change their order) or a separator to go through all the trouble with multiple windows.
In my case it is one simple window. I don't use distinct windows for every column, nor are the separators own windows.
It is way to simple to check if the mouse is over a column (wich can be dragged around too in my control, to change their order) or a separator to go through all the trouble with multiple windows.
-
- I live to help wx-kind
- Posts: 192
- Joined: Fri Dec 22, 2006 9:17 am
- Location: Germany
- Contact: