Search found 47 matches

by denarced
Wed Feb 01, 2012 11:46 am
Forum: C++ Development
Topic: How to wait for hardware to appear
Replies: 3
Views: 1546

How to wait for hardware to appear

Hello, I have an operation in which I'm waiting for a USB stick to be plugged into the computer. The question is how to wait for it. Background Now there's a modeless dialog BatchDialog (wxDialog) with two buttons: next and abort. The BatchDialog has an observer ( wiki ), BatchDialogObserver. The ob...
by denarced
Tue Jan 31, 2012 2:40 pm
Forum: C++ Development
Topic: wxDialog crashes
Replies: 3
Views: 997

Re: wxDialog crashes

Ok After checking out about a dozen revisions using divide and conquer technique (or binary search), the culprit has been found: I destroy the dialog when it's shown :D The only miracle is that it didn't crash on 64bit Windows 7 and that's why I didn't notice it earlier, because I develop on that pl...
by denarced
Tue Jan 31, 2012 12:59 pm
Forum: C++ Development
Topic: wxDialog crashes
Replies: 3
Views: 997

wxDialog crashes

Hello,

I'm using version 2.9.1 and when I try to show wxDialog (dialog.Show()), the program crashes.
I have no idea where to start looking for the culprit .. any ideas ?
Null pointer has been checked, that's not it.
Curiously enough, the crash occurs on 32 bit Windows but not on 64 bit.
by denarced
Wed Jan 25, 2012 11:42 am
Forum: C++ Development
Topic: A modeless window with a modal twist
Replies: 5
Views: 1107

Re: A modeless window with a modal twist

Thanks for all the responses! Auria, your suggestion seems doable (easy enough) so I'll give it a try. Radek, your suggestion seems like heavy duty hack indeed. It appears to be a sound solution to the problem I have presented. I just didn't know that I'd have to get that deep into hacking :). I'll ...
by denarced
Wed Jan 25, 2012 11:32 am
Forum: C++ Development
Topic: stupid problem -can t close window
Replies: 4
Views: 1315

Re: stupid problem -can t close window

I'm thinking it's about the Skip method call.
Command events propagate, others don't => that includes the close event and when you Skip then that's it.
You handled the close event and decided to skip it. Nothing more will be done since you're not doing anything
more and the event won't be propagated.
by denarced
Mon Jan 23, 2012 11:19 am
Forum: C++ Development
Topic: A modeless window with a modal twist
Replies: 5
Views: 1107

A modeless window with a modal twist

Hello, in all simplicity, this is what I'm trying to achieve: Open dialog to user to observe the progress of connecting to a server and doing stuff afterwards. Start connecting to the server, pass the object handling it a pointer to the dialog (probably as an abstract super class pointer) The connec...
by denarced
Wed Jan 18, 2012 8:20 am
Forum: C++ Development
Topic: wxChoice that's narrower than its items
Replies: 2
Views: 734

Re: wxChoice that's narrower than its items

Isn't that the default? AFAIK the width of the control is totally independent of its content. Then there's something I'm missing .. I tried this in two ways: with sizehints and without. Without setting sizehints it expands to adjust for the widest item. With sizehints it makes it narrow but you als...
by denarced
Tue Jan 17, 2012 11:23 am
Forum: C++ Development
Topic: wxChoice that's narrower than its items
Replies: 2
Views: 734

wxChoice that's narrower than its items

Hello,

is it possible to create a wxChoice that's less wide than the items that are contained in it?
Or do I have to use some other component? Please tell me I don't have to create one myself :)
by denarced
Mon Jan 16, 2012 5:03 pm
Forum: C++ Development
Topic: MVC and encapsulation
Replies: 5
Views: 2320

Re: MVC and encapsulation

you need to add some event handlers so you inherit some of the classes. that is incorrect : with Connect (and in 2.9 Bind), you do not need to use inheritance to use event handlers ( http://wxwidgets.blogspot.com/2007/01/in-praise-of-connect.html ) Oops, that was a slip up. The problem still remain...
by denarced
Mon Jan 16, 2012 1:27 pm
Forum: C++ Development
Topic: MVC and encapsulation
Replies: 5
Views: 2320

Re: MVC and encapsulation

Basically that means exactly creating all of that in one class so all of the pointers are available directly in the inherited class. Thanks for your reply! Your description fits precisely on how I did it in my last project. The good thing was that modifying things was extremely easy. The downside w...
by denarced
Mon Jan 16, 2012 11:09 am
Forum: C++ Development
Topic: Binding a no-args member function to an event
Replies: 5
Views: 2334

Re: Binding a no-args member function to an event

Hi, I've not tried this, but search in the Events and Event Handling overview for: "With the aid of boost::bind<>() you can even use methods or functions which don't quite have the correct signature:" Regards, David Even the example on the page to which you linked has an event argument .. I guess i...
by denarced
Mon Jan 16, 2012 8:46 am
Forum: C++ Development
Topic: Binding a no-args member function to an event
Replies: 5
Views: 2334

Re: Binding a no-args member function to an event

Observer::notify() must be defined to take a wx[Command]Event& parameter. I don't think it'll work otherwise. That's how it's currently implemented in program. I was afraid that it's a requirement, but the documentation at least suggests that it's not. At 2.9.1 wxEvtHandler documentation it says th...
by denarced
Mon Jan 16, 2012 8:41 am
Forum: C++ Development
Topic: MVC and encapsulation
Replies: 5
Views: 2320

MVC and encapsulation

Hello, I've been thinking about not encapsulating my classes; this sounds very wrong to me but I'd like to know if you agree with my reasoning. Let's say we have a GUI, which consists of a lot widgets which can be represented in a hierarchy. For example: wxApp wxFrame wxMenu wxMenuItem (probably mor...
by denarced
Mon Jan 16, 2012 7:32 am
Forum: C++ Development
Topic: Binding a no-args member function to an event
Replies: 5
Views: 2334

Binding a no-args member function to an event

Hi, as I understand the documentation, Bind should be able to take a boost functor but I can't get it to work. Here's the code: void MyApp::registerObserver(Observer *observer) { boost::function<void ()> fp = boost::bind(&Observer::notify, observer); this->Bind(wxEVT_COMMAND_TEXT_UPDATED, fp, GuiId:...
by denarced
Thu Jan 12, 2012 1:21 pm
Forum: C++ Development
Topic: How to implement timeout behavior for wxTextCtrl
Replies: 2
Views: 1009

Re: using wxTimer in OneShot mode

JimFairway, your suggestion was pretty perfect.
I'll have to remember that the next time when I'm implementing something like this.
Thanks!

I did however implement one solution which is based on threads.
And it works so I'm too lazy to change it now :)