Search found 1789 matches

by PB
Wed Jan 16, 2019 5:32 pm
Forum: C++ Development
Topic: Lose focus event for wxTextCtrl? [SOLVED]
Replies: 14
Views: 882

Re: Lose focus event for wxTextCtrl? [SOLVED]

Please do not quote whole posts, perhaps no quoting is necessary when responding to the last post. Are you sure the notebook issue is caused by handling the kill focus event, i.e., it persists even when you do not bind the handler for the event? TBH, I am not sure what the issue is exactly, and what...
by PB
Tue Jan 15, 2019 10:25 pm
Forum: C++ Development
Topic: wxMemoryDC on wxBitmap uses button background/foreground
Replies: 5
Views: 73

Re: wxMemoryDC on wxBitmap uses button background/foreground

wxWidgets version and platform? I do not observe any such issues (the buttons having regular outline is not the focus of this topic) with code below, except wxMemoryDC.Clear() not filling the bitmap with the current brush? MS Windows, wxWidgets 3.1.2. memorydc text.png Obviously one has to properly ...
by PB
Tue Jan 15, 2019 8:21 pm
Forum: C++ Development
Topic: Lose focus event for wxTextCtrl? [SOLVED]
Replies: 14
Views: 882

Re: Lose focus event for wxTextCtrl? [SOLVED]

What do you mean by "problems to acces the textCtrl"? Do you mean that the user cannot set focus to the control with keyboard and/or mouse? Do you call event.Skip() in the wxEVT_KILL_FOCUS handler (see my previous code)? Can you reproduce the issue with the MyDialog code below? #include <w...
by PB
Sun Jan 13, 2019 8:30 pm
Forum: Platform Related Issues
Topic: Problem with MDI on windows 10
Replies: 8
Views: 120

Re: Problem with MDI on windows 10

Your build line seems OK, except it is recommended to prepend the build directory, i.e. PATH=C:\Program Files (x86)\CodeBlocks\MinGW\bin;%PATH% I would certainly always make a debug build as well, not to mention when running into an issue. Code::Blocks support multiple build configurations just fine...
by PB
Sun Jan 13, 2019 8:12 am
Forum: Platform Related Issues
Topic: Problem with MDI on windows 10
Replies: 8
Views: 120

Re: Problem with MDI on windows 10

The usual procedure would be to debug it to see where (and why?) it gets wrong. My guess is when even the MDI sample, does not work, the issue is with your wxWidgets build/setup. How did you exactly built it and your app? BTW, there are no wxWidgets 3.1.1.7: I would try the last release in the 3.1 b...
by PB
Tue Jan 08, 2019 5:43 pm
Forum: C++ Development
Topic: Adding a control (or sizer) between two other controls (or sizers). [SOLVED]
Replies: 9
Views: 224

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

What's the purpose of GetClientData if I have to use a std::map? You certainly do not need to use a map, it was just a generic example of relating a button to a sizer when I knew nothing about your code. However, I would not use client data, I believe they are not well suited for this. Here is an e...
by PB
Tue Jan 08, 2019 1:35 pm
Forum: C++ Development
Topic: Adding a control (or sizer) between two other controls (or sizers). [SOLVED]
Replies: 9
Views: 224

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

FWIW, below is an example of code demonstrating one of the ways how to create a relationship between a button and a sizer , using std::map with buttons as keys to sizers (for simplicity sake, the code does not bother setting the correct tab order). I think that applications allowing such flexibility...
by PB
Tue Jan 08, 2019 12:05 pm
Forum: C++ Development
Topic: Adding a control (or sizer) between two other controls (or sizers). [SOLVED]
Replies: 9
Views: 224

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

Client data is stored in wxClientDataContainer, where the documentation says (emphasis mine) This data can either be of type void - in which case the data container does not take care of freeing the data again or it is of type wxClientData or its derivatives. In that case the container will free the...
by PB
Tue Jan 08, 2019 6:38 am
Forum: C++ Development
Topic: Dynamically creating a text field. [SOLVED]
Replies: 12
Views: 196

Re: Dynamically creating a text field. [SOLVED]

Sorry, I do not understand. I would do as I wrote before, but of course it depends on your code, e.g. on how many sizers you need to keep track of...
by PB
Mon Jan 07, 2019 1:30 pm
Forum: C++ Development
Topic: Lose focus event for wxTextCtrl? [SOLVED]
Replies: 14
Views: 882

Re: Re: [SOLVED]

gtafan wrote:So it was really Connect(), that cased the problem?


No, the problem was as both David and me wrote: You changed the control on which the method (Connect) is called, from wxTextCtrl to (probably) its parent. If you did the same to Bind(), it would be wrong as well.
by PB
Mon Jan 07, 2019 1:22 pm
Forum: C++ Development
Topic: Dynamically creating a text field. [SOLVED]
Replies: 12
Views: 196

Re: Dynamically creating a text field. [SOLVED]

I am sorry I was wrong, you cannot do it like this. While GetEventUserData() works, wxWidgets takes ownership of the user data object passed to Bind() and destroys it upon disconnecting the handler or on program termination. This of course messes things up. You need to change the code, I would just ...
by PB
Mon Jan 07, 2019 11:55 am
Forum: C++ Development
Topic: Lose focus event for wxTextCtrl? [SOLVED]
Replies: 14
Views: 882

Re: Re: [SOLVED]

Seems not to worck for me, the only diference I am using Connect instead of Bind: Connect(ID_TEXTCTRL1,wxEVT_KILL_FOCUS,(wxObjectEventFunction)&MyFrame::OnKillFocus); Actually, it seems you made another important change, which broke the code. You now call Connect() on MyFrame, not on the wxText...
by PB
Mon Jan 07, 2019 11:49 am
Forum: C++ Development
Topic: Dynamically creating a text field. [SOLVED]
Replies: 12
Views: 196

Re: Dynamically creating a text field. [SOLVED]

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_BUTTON, &MyDialog::OnRemoveTextField, this, -1, -1, bSizer2); I believe not, according to the documentation, the user data object s...
by PB
Mon Jan 07, 2019 8:48 am
Forum: C++ Development
Topic: Dynamically creating a text field. [SOLVED]
Replies: 12
Views: 196

Re: Dynamically creating a text field. [SOLVED]

purplex88 wrote: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?

As I wrote above, I would just store pointers to the controls upon creating them.
by PB
Mon Jan 07, 2019 8:14 am
Forum: C++ Development
Topic: Dynamically creating a text field. [SOLVED]
Replies: 12
Views: 196

Re: Dynamically creating a text field. [SOLVED]

Thanks. How to keep track of added controls which are randomly added? I do not understand "randomly added". There must be a code adding those controls and this code should be modified to not only add the control to the dialog but add it also to the internal list (e.g., std::vector<wxTextC...

Go to advanced search