Search found 2662 matches

by PB
Sat Nov 28, 2020 4:43 pm
Forum: C++ Development
Topic: How to correctly update centred static text
Replies: 6
Views: 147

Re: How to correctly update centred static text

I meant instead of mainSizer->Add(labelSizer, wxSizerFlags().Expand()); do mainSizer->Add(buttonOutputText, wxSizerFlags().CentreHorizontal().Border()); I.e., not having labelSizer at all. As for enabling keys, I would just add a method like this void KeyboardPanel::EnableKey(int keyCode, bool enabl...
by PB
Sat Nov 28, 2020 3:28 pm
Forum: C++ Development
Topic: How to correctly update centred static text
Replies: 6
Views: 147

Re: How to correctly update centred static text

I do not understand purpose of your labelSizer? A sizer with just one item is generally suspicious.

Did you try adding buttonOutputText directly to mainSizer?
by PB
Sat Nov 28, 2020 8:27 am
Forum: C++ Development
Topic: How to correctly update centred static text
Replies: 6
Views: 147

Re: How to correctly update centred static text

I think you need to call Layout() on the sizer containing the control (or even sizer containing that sizer). This seems to work as expected, even without using wxALIGN_CENTRE_HORIZONTAL for wxStaticText, just centering the label inside its sizer "cell". #include <wx/wx.h> class MyDialog : public wxD...
by PB
Fri Nov 27, 2020 7:41 pm
Forum: C++ Development
Topic: What is the difference between wxString and std::string
Replies: 10
Views: 135

Re: What is the difference between wxString and std::string

They were both introduced long before the STL became widely available and reliable on all the platforms wxWidgets supported.

AFAIK, wxVector does have anything over std::vector; however, if you look at wxString API there are few methods that can be handy and std::(w) string does not offer them.
by PB
Fri Nov 27, 2020 1:34 pm
Forum: C++ Development
Topic: Problems with using own Events based on wxEvent
Replies: 6
Views: 88

Re: Problems with using own Events based on wxEvent

But still I have sometimes segmentation faults. I will try to use wxTreadEvents(). But I must found out, how I can derivate my event class from this, because now I derivate from wxCommandEvent, which is derivated from wxEvent. The segfaults may not be related to the event system. I am not sure what...
by PB
Fri Nov 27, 2020 12:36 pm
Forum: C++ Development
Topic: Problems with using own Events based on wxEvent
Replies: 6
Views: 88

Re: Problems with using own Events based on wxEvent

Sorry, forgot to write that you should basically replace

Code: Select all

wxQueueEvent(OwnerDB[idx].owner,&evt);
with

Code: Select all

wxQueueEvent(OwnerDB[idx].owner, evt.Clone());
by PB
Fri Nov 27, 2020 12:27 pm
Forum: C++ Development
Topic: Problems with using own Events based on wxEvent
Replies: 6
Views: 88

Re: Problems with using own Events based on wxEvent

I´ve created a own Event class (have a look to the end of this message). I´ve created a thread based on wxThread. I think that events sent from threads should be derived from wxThreadEvent. From this thread I fire the events with wxQueueEvent(OwnerDB[idx].owner,&evt); The owners are stored in a std...
by PB
Thu Nov 26, 2020 7:22 pm
Forum: Compiler / Linking / IDE Related
Topic: wxSmith wxDialog problems when program is run
Replies: 61
Views: 1245

Re: wxSmith wxDialog problems when program is run

I don't need to differentiate between right and left shift, alt or control because in most applications they work the same. I do understand that and I also understand you are just playing. Still, I would find odd toggling the right shift and next time I open the window the left and not right one wa...
by PB
Thu Nov 26, 2020 6:06 pm
Forum: Compiler / Linking / IDE Related
Topic: wxSmith wxDialog problems when program is run
Replies: 61
Views: 1245

Re: wxSmith wxDialog problems when program is run

I think this would be better done as is my latest example. If only that saving keys based on the labels will not be capable of differentiating between right and left variants (Shift, Ctrl and others). Unlike in my sample, the "control" keys could be assigned a negative value to make sure they sort f...
by PB
Wed Nov 25, 2020 4:12 pm
Forum: C++ Development
Topic: Bug in wxListBox event handing?
Replies: 2
Views: 76

Re: Bug in wxListBox event handing?

If it is on MSW, try creating the popup with wxPU_CONTAINS_CONTROLS style
with https://docs.wxwidgets.org/trunk/classw ... indow.html

IIRC, there were some changes in wxPopUp(Transient?)WIndow in 3.1.3.
by PB
Wed Nov 25, 2020 11:02 am
Forum: Compiler / Linking / IDE Related
Topic: wxSmith wxDialog problems when program is run
Replies: 61
Views: 1245

Re: wxSmith wxDialog problems when program is run

Then I added a windowsplitter, ... I don't want the windows splitter to be draggableL. The whole purpose of a splitter is to allow the user change window proportions by dragging it. If you do not want a splitter to be draggable, you do not need it and should use a sizer instead. I notice there are ...
by PB
Wed Nov 25, 2020 10:26 am
Forum: C++ Development
Topic: Using wxString in wx3.x
Replies: 3
Views: 96

Re: Using wxString in wx3.x

For variadic C functions such as printf, you can check this
https://docs.wxwidgets.org/trunk/overvi ... ing_advice
by PB
Tue Nov 24, 2020 6:03 pm
Forum: C++ Development
Topic: Processing of key messages
Replies: 9
Views: 371

Re: Processing of key messages

I see no one recommended this old but gold one yet ;)

Please build, run and test the keyboard sample bundled with wxWidgets and see if what gets logged there matches what you expect to see.
by PB
Tue Nov 24, 2020 5:48 pm
Forum: Compiler / Linking / IDE Related
Topic: wxSmith wxDialog problems when program is run
Replies: 61
Views: 1245

Re: wxSmith wxDialog problems when program is run

I think wxWidgets is quite easy to learn and use. Of course, it is not perfect and IMO it cannot compare to Qt but is still good enough for many tasks. And unlike Qt, it is really free to use with no strings attached. And since I am already speaking frankly, I would recommend abandoning C++ and swit...
by PB
Tue Nov 24, 2020 3:40 pm
Forum: Compiler / Linking / IDE Related
Topic: wxSmith wxDialog problems when program is run
Replies: 61
Views: 1245

Re: wxSmith wxDialog problems when program is run

So I separated the code into separate classes, and what is cool about this I can use the same keyboard panel for the add and update. It is like the child of the parent form. So you can design a whole panel and use the same thing in other layouts. Sorry, I thought it was obvious that the KeyboardPan...