Search found 14 matches

by RichardW
Wed Dec 02, 2015 8:25 pm
Forum: C++ Development
Topic: Setting clientdata in a wxGridCellEditor. [SOLVED]
Replies: 8
Views: 693

Re: Setting clientdata in a wxGridCellEditor. [SOLVED]

Well, I can't argue that. :)

Now, every time I call GetCellEditor(), it looks something like this:

Code: Select all

te=(TextEditor*)grid->GetCellEditor(row,col);
projectid=te->GetData();
te->DecRef();


Thank you for all your help!
Richard
by RichardW
Wed Dec 02, 2015 7:00 pm
Forum: C++ Development
Topic: Setting clientdata in a wxGridCellEditor. [SOLVED]
Replies: 8
Views: 693

Re: Setting clientdata in a wxGridCellEditor. [SOLVED]

the GetCellEditor() call from your first post will increase the internal reference counter for the editor I see the IncRef() in wxGridCellAttr::GetEditor. I guess I don't understand why anything's getting incremented when you're just returning a pointer. There's no memory allocation. Why would refc...
by RichardW
Wed Dec 02, 2015 4:42 pm
Forum: C++ Development
Topic: Setting clientdata in a wxGridCellEditor. [SOLVED]
Replies: 8
Views: 693

Re: Setting clientdata in a wxGridCellEditor. [SOLVED]

Indeed, a vector of {row,col,projectid} would work nicely. I may use that instead of what I did, shown below... What I did instead, and I only mention it for completeness, is implement a very simple GridCellEditor: class TextEditor : public wxGridCellTextEditor { wxString cdata; public: void SetData...
by RichardW
Wed Dec 02, 2015 2:48 pm
Forum: C++ Development
Topic: Setting clientdata in a wxGridCellEditor. [SOLVED]
Replies: 8
Views: 693

Re: Setting clientdata in a wxGridCellEditor. [SOLVED]

I am trying to mimic something similar to a Gantt chart in the grid. I have projects that run across multiple columns and I was trying to store their IDs as clientdata. The fields are not editable. Instead, when you click them, an edit screen opens to allow editing of multiple properties. Here's an ...
by RichardW
Tue Dec 01, 2015 10:41 pm
Forum: C++ Development
Topic: Setting clientdata in a wxGridCellEditor. [SOLVED]
Replies: 8
Views: 693

Setting clientdata in a wxGridCellEditor. [SOLVED]

I've created a trivial 5x5 wxGrid. I prime its first column thusly: int row; wxStringClientData* data; for (row=0;row<5;++row) { grid->SetCellValue(row,0,wxString::Format("row %d",row)); data = new wxStringClientData(wxString::Format("%d",row)); grid->GetCellEditor(row,0)->SetCli...
by RichardW
Wed Oct 21, 2015 4:15 pm
Forum: wxCode
Topic: Events in wxFreeChart
Replies: 3
Views: 1091

Re: Events in wxFreeChart

Just to give an update, I completely chickened out. Instead of using wxFreeChart, I rolled my own Gantt chart using a grid bag sizer. It's not as pretty, but grabbing events is much easier. It looks like events are on the original developer's todo list, but the last update was some time ago so they ...
by RichardW
Fri Oct 09, 2015 3:51 am
Forum: wxCode
Topic: Events in wxFreeChart
Replies: 3
Views: 1091

Re: Events in wxFreeChart

I did see those but I couldn't understand why they need a Dataset as a parameter as one has already been passed to the plot. But maybe I don't understand something yet. I'll continue to work on this.
by RichardW
Thu Oct 08, 2015 2:54 am
Forum: wxCode
Topic: Events in wxFreeChart
Replies: 3
Views: 1091

Events in wxFreeChart

What I've done is built a simple Gantt chart. What I'd like to do is be able to handle mouse clicks on the Gantt bars. Ideally, I'd like the user to be able to drag the bar back and forth on the horizontal axis but... baby steps for now. It's trivial get the mouse coordinates from the click event, b...
by RichardW
Fri Aug 22, 2014 4:34 pm
Forum: C++ Development
Topic: Custom combobox grid editor to default to selected items [SOLVED]
Replies: 7
Views: 1321

Re: Custom combobox grid editor to default to selected items [SOLVED]

Well, here's the update: I've copped out and worked around this. The whole reason I wanted to do this was to hide the meaningless ID with the meaningful text. So, instead of storing the ID in the base table, I'm storing the text, so that's what appears instead of the ID. This does basically what I w...
by RichardW
Thu Aug 21, 2014 9:51 pm
Forum: C++ Development
Topic: Custom combobox grid editor to default to selected items [SOLVED]
Replies: 7
Views: 1321

Re: Custom combobox grid editor to default to selected items [SOLVED]

OK, I'll take a look at this. Thanks for your help.

It should also be noted that the wxGridCellEnumEditor works like this as well.

Richard
by RichardW
Thu Aug 21, 2014 9:21 pm
Forum: C++ Development
Topic: Custom combobox grid editor to default to selected items [SOLVED]
Replies: 7
Views: 1321

Re: Custom combobox grid editor to default to selected items [SOLVED]

Maybe you could try wxGrid::SetGridCursor() and wxGrid::ShowCellEditControl() for each row. But I really have my doubts that will work in the end... I tried it and your doubts are well-founded--It did not work. Would events not work for something like this? To activate the editor, I must first sele...
by RichardW
Thu Aug 21, 2014 8:32 pm
Forum: C++ Development
Topic: Custom combobox grid editor to default to selected items [SOLVED]
Replies: 7
Views: 1321

Re: Custom combobox grid editor to default to selected items [SOLVED]

The whole concept of wxGrid is based on the idea that only one cell editor exists at any given time. Except... It doesn't look like that. What I want is *exactly* img2.jpg above. If I click on every row in column 1, I get what I want. If I could simulate a leftclick for each one, I'll have what I w...
by RichardW
Thu Aug 21, 2014 6:06 pm
Forum: C++ Development
Topic: Custom combobox grid editor to default to selected items [SOLVED]
Replies: 7
Views: 1321

Custom combobox grid editor to default to selected items [SOLVED]

I've built a simple combobox grid editor to store data in a key -> value way, using wxStringClientData to store the key. Everything is working, however I want to hide the key by having the comboboxes open immediately upon drawing the grid. Here is what it looks like when first opened: img1.jpg By st...
by RichardW
Fri Apr 25, 2014 5:20 am
Forum: The Code Dump
Topic: wxAutomation and ADO work well together
Replies: 0
Views: 1390

wxAutomation and ADO work well together

I struggled and struggled with this and finally got it going. I'd like to share what I've done and hopefully it'll help someone avoid the hours of crashing code. (SetDispatchPtr(NULL)?!?!? ... Really?) This set of classes references the ADODB automation objects. This sample uses an Access Database t...

Go to advanced search