Set wxDataViewColumn Column Positions [thread redirect]

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Dafarkias
Earned a small fee
Earned a small fee
Posts: 15
Joined: Mon Apr 26, 2021 7:57 pm

Set wxDataViewColumn Column Positions [thread redirect]

Post by Dafarkias » Mon May 03, 2021 10:40 pm

Hey!

:D

I figured I would just reuse this thread, since I figured out the answer to my prior question short after posting :P

My new quandary is that I can't seem to figure out how to 'lock' a column to a certain position, in wxDataViewListCtrl.

I want certain columns to be draggable, which I achieve using the flag "wxDATAVIEW_COL_REORDERABLE", but I want a specific column to always be the last slot.

If I set all the columns to be reorderable except my desired slot, the reorderable slots can still be moved past its location.

My next idea was to trigger a "wxEVT_DATAVIEW_COLUMN_REORDERED" event, and then reassign my column accordingly whenever the user reorders columns, but there are two issues with this idea I'm running into:

(A)
I'm not finding a SetColumnPosition function

(B)
When I try to duplicate the column, append it, and then delete the original, it is not placed at the last column position; rather, the second to last.

Any help would be really appreciated!
Last edited by Dafarkias on Tue May 04, 2021 3:35 pm, edited 3 times in total.

Dafarkias
Earned a small fee
Earned a small fee
Posts: 15
Joined: Mon Apr 26, 2021 7:57 pm

Re: Set wxDataViewColumn Minimum Width?

Post by Dafarkias » Mon May 03, 2021 11:14 pm

The event code looks something like this:

Code: Select all

    void OnReorder(wxDataViewEvent& event)
    {
        wxDataViewColumn* column2 = columnComment;
        this->InsertColumn(this->GetColumnCount(), column2); 
        this->DeleteColumn(columnComment);
        event.Skip();
    }
Image

And as you can see, the append function is not adding the column on to the end, but rather, before the "squash" column.

Is there a way to prevent this behavior?

Post Reply