Search found 235 matches

by purplex88
Tue Jan 08, 2019 3:48 pm
Forum: C++ Development
Topic: Adding a control (or sizer) between two other controls (or sizers).
Replies: 9
Views: 1055

Re: Adding a control (or sizer) between two other controls (or sizers).

Here's what I am trying to do: sizer.png The red boxes are BoxSizers. So, I click minus button, it should completely the sizer in which controls are placed. That is easy to do as suggested by @PB i.e. by using std::map to maintain button and sizer relationship. So, when the minus button is clicked, ...
by purplex88
Tue Jan 08, 2019 10:29 am
Forum: C++ Development
Topic: Adding a control (or sizer) between two other controls (or sizers).
Replies: 9
Views: 1055

Re: Adding a control (or sizer) between two other controls (or sizers).

Thanks, doublemax!

If I pass a wxTextCtrl as client data, then it really becomes my responsiblity to destroy the control or wxWidgets will free its memory when program terminates as usual?
by purplex88
Tue Jan 08, 2019 6:48 am
Forum: C++ Development
Topic: Adding a control (or sizer) between two other controls (or sizers).
Replies: 9
Views: 1055

Adding a control (or sizer) between two other controls (or sizers).

I just want to confirm and ask these two things: 1. What's the purpose of SetClientData and GetClientData? Is it my own user data? I couldn't find much information on it. Can it be a wxWidgets object or user data? 2. Can I dynamically add a button between two buttons in a sizer? In the same way, can...
by purplex88
Tue Jan 08, 2019 6:44 am
Forum: C++ Development
Topic: Dynamically creating a text field.
Replies: 12
Views: 904

Re: Dynamically creating a text field.

Okay, thanks. Everything works but I have other questions which I guess I should ask in new thread.
by purplex88
Tue Jan 08, 2019 5:29 am
Forum: C++ Development
Topic: Dynamically creating a text field.
Replies: 12
Views: 904

Re: Dynamically creating a text field.

That means I can't store handles to objects in UserData but can I at least keep an ID of Sizer? That information is necessary to let me know which sizer to delete as I click [minus] button to remove the textfield.

Should I use SetClientData, SetClientObject or EventUserData ?
by purplex88
Mon Jan 07, 2019 12:21 pm
Forum: C++ Development
Topic: Dynamically creating a text field.
Replies: 12
Views: 904

Re: Dynamically creating a text field.

It's now this error:
getuserdata.png
getuserdata.png (39.25 KiB) Viewed 867 times
I have never used this GetEventUserData() method before. Sure not GetClientData()?
by purplex88
Mon Jan 07, 2019 10:53 am
Forum: C++ Development
Topic: Dynamically creating a text field.
Replies: 12
Views: 904

Re: Dynamically creating a text field.

To dynamically remove the text field, I'm deleting its sizer which holds it. m_Sizer->Clear(true); I suppose this is the right way. But I am getting a runtime error for it because of this: wxBoxSizer *m_Sizer = (wxBoxSizer*)event.GetEventObject(); Am I setting it correctly? m_button->Bind(wxEVT_BUTT...
by purplex88
Mon Jan 07, 2019 8:27 am
Forum: C++ Development
Topic: Dynamically creating a text field.
Replies: 12
Views: 904

Re: Dynamically creating a text field.

Yeah, makes sense to have a vector there. Do I need the ID of each or ANY id can work since I have the handle already?
by purplex88
Mon Jan 07, 2019 6:30 am
Forum: C++ Development
Topic: Dynamically creating a text field.
Replies: 12
Views: 904

Re: Dynamically creating a text field.

Thanks. How to keep track of added controls which are randomly added?
by purplex88
Mon Jan 07, 2019 6:07 am
Forum: C++ Development
Topic: Dynamically creating a text field.
Replies: 12
Views: 904

Dynamically creating a text field.

I want to dynamically create a text field when '+' sign is clicked next to it.

How would I go iterate all the text fields in the dialog box since I won't know their IDs and such? Probably there's a way to enumerate all and knowing they exist so I can get the data into vector<string>.
by purplex88
Sat Jan 05, 2019 11:06 pm
Forum: C++ Development
Topic: Drawing selectable and movable shapes
Replies: 1
Views: 359

Drawing selectable and movable shapes

I would like to work on a flow chart drawing application where I can place and draw shapes on a whiteboard window. I also want to select and move these shapes. So, how should I begin and approach this problem to start with? Should I use a library? GDI? I would like to know how can I select the shape...
by purplex88
Sat Dec 22, 2018 1:06 am
Forum: C++ Development
Topic: Export wxListCtrl Data to Excel
Replies: 3
Views: 499

Export wxListCtrl Data to Excel

I will have thousands of items in wxListCtrl in future. So, is it possible to export the rows and columns of wxListCtrl Data to Excel file?

Second question: I also read somewhere that there's a virtual wxListCtrl or something which is somehow able to handle that many items. Is that also true?
by purplex88
Sun Sep 16, 2018 3:28 pm
Forum: C++ Development
Topic: wxButtons with Image Flicker on Frame Resize.
Replies: 1
Views: 276

Re: wxButtons with Image Flicker on Frame Resize.

Yes, adding wxPanel solved it. I wasn't sure why I needed it though.
by purplex88
Sun Sep 16, 2018 12:52 pm
Forum: C++ Development
Topic: wxButtons with Image Flicker on Frame Resize.
Replies: 1
Views: 276

wxButtons with Image Flicker on Frame Resize.

I have several wxButtons placed on wxFrame for which I set Bitmap images. wxBitmap Bitmap1(....) m_button1 = new wxButton(this, BUTTON1_ID, wxT(""), wxDefaultPosition, wxDefaultSize, wxTRANSPARENT_WINDOW | wxBORDER_NONE); m_button1->SetBitmap(Bitmap1); The problem is when I resize the wxFrame, all t...
by purplex88
Tue Sep 11, 2018 8:31 am
Forum: C++ Development
Topic: How can I load PNG files from Resource?
Replies: 9
Views: 1888

Re: How can I load PNG files from Resource?

I am not sure why the method specified by doublemax won't work. I just haven't seen any tutorial where they use # with number identifier from resource.h.

Edit: Okay, I figured that out as well. Doublemax's method will work if I delete the IDs from resource.h file.