Search found 58 matches

by zobbo
Sat Feb 28, 2009 7:20 am
Forum: C++ Development
Topic: Firing an event manually
Replies: 7
Views: 1362

Firing an event manually

Hello, I've been trying to figure out a testing regime and I think I can get it working, but I'm stuck trying to fire "real" events manually. I have stubs running ok, but this requires the event handlers being called explicitly with an event object passed as a parameter, so it doesn't really test th...
by zobbo
Wed Jan 14, 2009 11:36 pm
Forum: C++ Development
Topic: Custom event query
Replies: 4
Views: 401

It's not a bad idea; it's just that there will seldom be a need for this. An event is usually created in one place, and then fired immediately at its target. It would be unusual to need to alter the event afterwards, or in two different methods. I see what you mean. My logic was that the event is f...
by zobbo
Tue Jan 13, 2009 11:01 pm
Forum: C++ Development
Topic: Custom event query
Replies: 4
Views: 401

Hi, But, I'd like to associate "event" with a class as a member I'm not sure why you'd want to do this, but you can: class MyWindow { wxPlotEvent event; ... }; // Inside MyWindow::SendEvent: event.SetEventType(wxEVT_PLOT_ACTION); event.SetId(GetId()); ... Regards, David Hi David, Thanks, that's eas...
by zobbo
Tue Jan 13, 2009 3:34 am
Forum: C++ Development
Topic: Custom event query
Replies: 4
Views: 401

Custom event query

Hi, I am following the sample code provided in wxWidgets 2.8.4 for Custom events. The code gives this as the code to send the event: // user code sending the event void MyWindow::SendEvent() { wxPlotEvent event( wxEVT_PLOT_ACTION, GetId() ); event.SetEventObject( this ); event.SetCurve( m_curve ); G...
by zobbo
Mon May 19, 2008 7:37 am
Forum: C++ Development
Topic: Event table macro and inheritance
Replies: 3
Views: 565

I've solved the memory leaks too. As usual I was being silly and creating a new instance of my Application, despite the fact that IMPLEMENT_APP(app) already does this. So I used DECLARE_APP(app) with wxGetApp() and voila, no more memory leaks either. :D

Thanks,
Zobbo
by zobbo
Sat May 17, 2008 7:27 am
Forum: C++ Development
Topic: Event table macro and inheritance
Replies: 3
Views: 565

Hi David,

Thanks, that did the trick. It's so simple when you know the answer :)

All memory leaks seem to be accounted for as well.

Thanks,
Zobbo
by zobbo
Sat May 17, 2008 6:45 am
Forum: Compiler / Linking / IDE Related
Topic: Linking errors in VC++ with overidden debug new/delete ops
Replies: 2
Views: 1001

Hi FullAction, thanks.

Yes, I decided to use the VC++ tools instead. It still doesn't tell me the line numbers, apparently I'm not the only one. I can figure them out using the allocation block number and then using a breakpoint on the alloc number, a bit lengthier, but it works.

Thanks,
Zobbo
by zobbo
Sun Apr 27, 2008 5:09 am
Forum: C++ Development
Topic: Event table macro and inheritance
Replies: 3
Views: 565

Event table macro and inheritance

Hello, I'm afraid it's me again. I'm back to my initial problem - an issue with a circular dependancy I don't really want. So, I have class TestApplication which derives from wxAppConsole. Then class Server. This derives from TestApplication. In Server, I have my event table macro: BEGIN_EVENT_TABLE...
by zobbo
Sun Apr 20, 2008 3:07 am
Forum: C++ Development
Topic: Help with memory leaks
Replies: 1
Views: 479

Help with memory leaks

Hello, I have some memory leaks in my code that I have tracked down using the MS VC++ debugger: m_eventsLocker = new wxCriticalSection; // BLOCK 145 //event.cpp line 1011 IMPLEMENT_APP_CONSOLE(TestApplication); //BLOCK 144 //TestApplication.cpp line 33 malloc(sizeof(wxStringData) + (nLen + EXTRA_ALL...
by zobbo
Sat Mar 29, 2008 10:20 pm
Forum: Compiler / Linking / IDE Related
Topic: Linking errors in VC++ with overidden debug new/delete ops
Replies: 2
Views: 1001

Linking errors in VC++ with overidden debug new/delete ops

Hello, I have some memory leaks, but without much info I can' track them down. So I am trying to use debugcontext. I have linking errors when trying to use the debug overriden new and delete operators for debugcontext. I set wxUSE_MEMORY_TRACING to 1, wxUSE_DEBUG_CONTEXT 1, wxUSE_GLOBAL_MEMORY_OPERA...
by zobbo
Sun Mar 16, 2008 1:12 am
Forum: C++ Development
Topic: Changing member variables outside contstructor
Replies: 8
Views: 622

The problem was actually pretty simple (i.e. me beig simple), I hadn't actually created an instance of Server at any point, so it was obviously a null pointer. I realised when following David's advice and using a breakpoint in the Server ctor, obviously the breakpoint was never reached. I'll know wh...
by zobbo
Wed Mar 12, 2008 7:10 am
Forum: C++ Development
Topic: Changing member variables outside contstructor
Replies: 8
Views: 622

The events work fine, it's just changing the member variables that are the problem. The events fire etc.. I have tried using a WxApp derived class before it was over complicating things with my test rig so I changed it to a console based app, but I never got as far as changing the member variables i...
by zobbo
Mon Mar 10, 2008 8:12 am
Forum: C++ Development
Topic: Changing member variables outside contstructor
Replies: 8
Views: 622

Hi, Thanks for your responses. It was a bit silly not showing my TestApplication code, so here it is: TestApplication.h: #pragma once // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" //#include <iostream> #ifdef __BORLANDC__ # pragma hdrstop #endif // for all ...
by zobbo
Sun Mar 09, 2008 6:35 am
Forum: C++ Development
Topic: Changing member variables outside contstructor
Replies: 8
Views: 622

Changing member variables outside contstructor

Hello, I have an issue with my code, in that I can set member variables, but only in the constructor. I can compile my code, however, it causes an access violation when I try to set a member variable set in the header file. I can get around this by declaring a variable within the cpp file, but that ...
by zobbo
Sun Mar 02, 2008 12:46 am
Forum: C++ Development
Topic: Returning values from non-custom events
Replies: 2
Views: 365

Event handlers don't have return values, they would make no sense. Where is the value going to be returned to? If you need some kind of "feedback" from an eventhandler you should set a member variable(note: this won't be automatically checked by anything when the event handler exits). -Max I know t...