Search found 26 matches

by cneng3
Wed Aug 08, 2018 9:51 pm
Forum: C++ Development
Topic: Change Spacer size during runtime
Replies: 7
Views: 1846

Re: Change Spacer size during runtime

All add() functions from wxSizer returns a point of wxSizerItem, which points to the new wxSizerItem they just created. In your case, this is your spacer. So as long as you keep tracks of these returned wxSizerItem pointers, you can modify them
by cneng3
Wed Aug 08, 2018 6:58 pm
Forum: C++ Development
Topic: No EVT_LIST_ITEM_DESELECTED for virtual list
Replies: 2
Views: 518

Re: No EVT_LIST_ITEM_DESELECTED for virtual list

I don't know, but EVT_LIST_ITEM_DESELECTED definitely didn't work with my virtual lists.
by cneng3
Tue Aug 07, 2018 7:19 pm
Forum: C++ Development
Topic: How to use wxSizer to layout 3 wxListView
Replies: 2
Views: 612

Re: How to use wxSizer to layout 3 wxListView

why not try to put all 3 wxListView inside a boxsizer
by cneng3
Tue Aug 07, 2018 7:08 pm
Forum: C++ Development
Topic: No EVT_LIST_ITEM_DESELECTED for virtual list
Replies: 2
Views: 518

No EVT_LIST_ITEM_DESELECTED for virtual list

Hello all,

I know this is a known issue and it's raised 14 years ago. However, do we have a solution for this after 14 years?

Thank you
by cneng3
Fri Jul 20, 2018 8:47 pm
Forum: C++ Development
Topic: Better way to refresh ListCtrl/ListView items
Replies: 9
Views: 4827

Re: Better way to refresh ListCtrl/ListView items

BTW, wxListCtrl in the virtual mode has RefreshItems() , in case you would need to refresh only a subset of items. BTW2, I hope it was understood but just to be sure: you also need to tell the list how many items are there with SetItemCount() . BTW3, the methods relevant for the virtual mode are li...
by cneng3
Fri Jul 20, 2018 4:37 pm
Forum: C++ Development
Topic: Better way to refresh ListCtrl/ListView items
Replies: 9
Views: 4827

Re: Better way to refresh ListCtrl/ListView items

doublemax wrote:You still need to call Refresh() when the data changes as the control itself has no knowledge about that.
Thank you so much!`
by cneng3
Fri Jul 20, 2018 4:17 pm
Forum: C++ Development
Topic: Better way to refresh ListCtrl/ListView items
Replies: 9
Views: 4827

Re: Better way to refresh ListCtrl/ListView items

"The application provides items text on demand" about wxLC_VIRTUAL. I'm not too sure about what it means. https://forums.wxwidgets.org/viewtopic.php?p=172585#p172585 This mentions a database as data source, but the principle is the same. So if I understand correctly, by making the listCtr...
by cneng3
Fri Jul 20, 2018 3:23 pm
Forum: C++ Development
Topic: Better way to refresh ListCtrl/ListView items
Replies: 9
Views: 4827

Re: Better way to refresh ListCtrl/ListView items

If your list happens to be displayed only in the report, what about using wxLC_VIRTUAL? Otherwise, there is probably not much to do. Its lack of elegance aside, Is there an actual issue (performance etc.) with the current implementation? Hi, I'm using wxLC_REPORT style. I just read the documentatio...
by cneng3
Fri Jul 20, 2018 2:50 pm
Forum: C++ Development
Topic: Better way to refresh ListCtrl/ListView items
Replies: 9
Views: 4827

Better way to refresh ListCtrl/ListView items

I have a std::set to hold some data that I want to display in a ListCtrl, and this std::set is constantly being modified so every time it gets modified, I need to sort it and refresh the ListCtrl. The current way I have is something like this ListCtrl * myList; void refreshList(const std::set& m...
by cneng3
Mon Jul 09, 2018 3:41 pm
Forum: C++ Development
Topic: Derived class of wxTimer doesn't work
Replies: 6
Views: 1161

Re: Derived class of wxTimer doesn't work

My code just somehow magically worked!!! I didn't change anything. Thx for all the advice guys!
by cneng3
Mon Jul 09, 2018 3:23 pm
Forum: C++ Development
Topic: Derived class of wxTimer doesn't work
Replies: 6
Views: 1161

Re: Derived class of wxTimer doesn't work

As doublemax said, you probably did something wrong in myClass ctor. This works as expected #include <wx/wx.h> class myClass : public wxTimer { public: myClass() {}; void Notify() override { wxLogMessage("myClass::Notify"); } }; class MyFrame : public wxFrame { public: MyFrame() : wxFrame...
by cneng3
Mon Jul 09, 2018 3:11 pm
Forum: C++ Development
Topic: Derived class of wxTimer doesn't work
Replies: 6
Views: 1161

Re: Derived class of wxTimer doesn't work

doublemax wrote:That looks ok. Did you call the default wxTimer constructor?
Yes, I'm not overriding the constructor. My constructor looks something like this

Code: Select all

myClass::myClass() {}
by cneng3
Mon Jul 09, 2018 5:10 am
Forum: C++ Development
Topic: Derived class of wxTimer doesn't work
Replies: 6
Views: 1161

Derived class of wxTimer doesn't work

Hello all, I'm trying to create a simple class that derives from wxTImer. So I have code like this: myClass.h class myClass : public wxTimer { public: myClass(); virtual ~myClass(); void Notify() override; } myClass.cpp /// ctor and dtor void myClass::Notify() { wxLogMessage("Notified"); }...
by cneng3
Fri May 18, 2018 3:30 pm
Forum: C++ Development
Topic: Launch Async Thread via Button
Replies: 10
Views: 3098

Re: Launch Async Thread via Button

Wow it actually worked! I knew the code could actually launch async threads but had no idea why they were still "synchronous" when I used std::launch::async. Thank you! void MyClass::OnButton_1Click(wxCommandEvent& event) { auto fut = std::async(std::launch::async, [this]{ /// code}); ...
by cneng3
Thu May 17, 2018 5:18 pm
Forum: C++ Development
Topic: Launch Async Thread via Button
Replies: 10
Views: 3098

Re: Launch Async Thread via Button

I'm afraid that I can't post the complete source code since what I'm working on doesn't mean to be an open source project. I'm sorry. I can only write some simple code to demonstrate what I'm trying to do here. And I don't quite understand your questions. I'm not using any pointers in std::async, ex...