Search found 78 matches

by Virchanza
Wed Jun 16, 2010 1:38 pm
Forum: C++ Development
Topic: wxMSW : Event Handler is multi-threaded???
Replies: 12
Views: 1767

OK I understand what you're saying about there being only one thread. The behaviour exhibited by the Event Handling System in wxMSW is very similar to interrupts on microcontrollers. With microcontrollers, when an interrupt is triggered, the currently executing function has all of its CPU registers ...
by Virchanza
Wed Jun 16, 2010 1:36 pm
Forum: C++ Development
Topic: wxMSW : Event Handler is multi-threaded???
Replies: 12
Views: 1767

OK I understand what you're saying about there being only one thread. The behaviour exhibited by the Event Handling System in wxMSW is very similar to interrupts on microcontrollers. With microcontrollers, when an interrupt is triggered, the currently executing function has all of its CPU registers ...
by Virchanza
Tue Jun 15, 2010 9:53 am
Forum: C++ Development
Topic: wxMSW : Event Handler is multi-threaded???
Replies: 12
Views: 1767

During Wait() some GUI related events are processed by using Yield* calls. Amazing. I'm actually amazed. Does this not cause all sorts of problems? I had no idea at all that two of my event handler routines could be executed simultaneously. What if these two functions access shared resources? I don...
by Virchanza
Tue Jun 15, 2010 9:51 am
Forum: C++ Development
Topic: Const-correctness help.
Replies: 14
Views: 1995

Virchanza: constness after return values are useful when you return pointers class X { private: Y* m_my_precious_data; public: /** I let you set it but not change it! */ const Y* getPreciousData() const { return m_my_precious_data; } }; Ah yes I agree about putting "const" on the "pointed-to" type,...
by Virchanza
Tue Jun 15, 2010 9:50 am
Forum: C++ Development
Topic: wxNotebook on MS-Windows 7 : Won't change panel
Replies: 11
Views: 1752

This is very subtle behavior; if no one else here knows, I may recommend asking on the mailing list, where you can reach wxWidgets authors. Another possibility, if you can, is to try the code under another platform; if there is a different behavior between platform then it is almost always right to...
by Virchanza
Mon Jun 14, 2010 10:10 am
Forum: C++ Development
Topic: wxNotebook on MS-Windows 7 : Won't change panel
Replies: 11
Views: 1752

Any news on this?

Should I report a bug?
by Virchanza
Mon Jun 14, 2010 10:09 am
Forum: C++ Development
Topic: Const-correctness help.
Replies: 14
Views: 1995

I never mark the return value of a function as const. There's no point in doing so unless you have a specific reason which depends on the inner workings of the class. I use const where-ever and whenever possible, except for these two cases: 1) The return values of functions 2) When casting to anothe...
by Virchanza
Mon Jun 14, 2010 9:46 am
Forum: C++ Development
Topic: wxMSW : Event Handler is multi-threaded???
Replies: 12
Views: 1767

Anybody? Can anyone explain how another event handler function begins execution before the first event handler function returns? Does anyone agree with me that the Event Handler System seems to be multi-threaded on wxMSW somehow (I mean how else can it call two functions at once?!). What's going on?
by Virchanza
Sun Jun 13, 2010 10:28 am
Forum: C++ Development
Topic: wxMSW : Event Handler is multi-threaded???
Replies: 12
Views: 1767

wxMSW : Event Handler is multi-threaded???

OK I'm getting really weird behaviour from wxMSW. It appears to be able to process two events at the same time, (i.e. it runs the code of two event handlers simultaneously), which indicates to me that the event handler is multi-threaded. But the event handler isn't supposed to be multi-threaded... i...
by Virchanza
Wed Jun 09, 2010 10:39 am
Forum: C++ Development
Topic: wxNotebook on MS-Windows 7 : Won't change panel
Replies: 11
Views: 1752

Just so you know, that code was generated by wxFormBuilder. When you use wxFormBuilder to handle events, it automatically writes the code, and for the PAGE_CHANGED event it came out with: m_notebook1->Connect(... Instead of: this->Connect(... I'm pretty new to wxWidgets and I don't know much at all ...
by Virchanza
Wed Jun 09, 2010 8:09 am
Forum: C++ Development
Topic: wxNotebook on MS-Windows 7 : Won't change panel
Replies: 11
Views: 1752

OK I've tried to put together minimalistic code that demonstrates this problem. First of all let me tell you what I did on MS-Windows 7 Ultimate. I downloaded the code for wxMSW, and I compiled it as follows: mingw32-make -f makefile.gcc BUILD=debug UNICODE=1 SHARED=0 RUNTIME_LIBS=static mingw32-mak...
by Virchanza
Tue Jun 08, 2010 10:06 am
Forum: C++ Development
Topic: wxNotebook on MS-Windows 7 : Won't change panel
Replies: 11
Views: 1752

I figured out the problem.

In my code, I processed two events from the notebook:
OnNotebookPageChanged
OnNotebookPageChanging

Here's my code for "OnNotebookPageChanged":

Code: Select all

void Dialog_Main::OnNotebook1_Page_Changed( wxNotebookEvent& event )
{
    /* All this function does is set the
       default button whenever a new tab
       is selected.
    */

    switch ( event.GetSelection() )
    {
    case 0: /* Step 1: Open Network Interface */

        m_button_Toggle_Open_Interface->SetDefault();
        m_combo_NetworkInterface->SetFocus();
        break;

    case 1: /* Step 2: Send ARP Requests */

        m_arptab_button_Toggle_Send_ARPs->SetDefault();
        m_arptab_txt_networks->SetFocus();
        break;

    case 2: /* Step 3: Send Internet Probes */

        m_probetab_button_Toggle_Send_Probes->SetDefault();
        m_probetab_txt_mac_src->SetFocus();
        break;

    default:

        assert("What the $%^&'s going on?!" == 0);
    }
}
This code works absolutely fine on GTK, but it's problematic on MS-Windows 7 Ultimate because it doesn't display the newly selected panel (the tab changes but it still displays the old panel).

The remedy is to add the following line to the end of that function:

Code: Select all

event.Skip();
This makes it work properly on MS-Windows 7 Ultimate.

Is this behaviour "acceptable" on the MS-Windows port of wxWidgets?

How should I know when to call Skip and when not to call Skip when I handle an event?

I decided to write "event.Skip()" at the end of my other event handler too (the event handler of PageChanging), but ironically this broke my program! If I call Skip at the end of the Page_Changing event handler, it ignores the previous call I made to event.Veto() and the tab control navigates to a tab which is supposed to be off-limits!
by Virchanza
Tue Jun 08, 2010 9:43 am
Forum: C++ Development
Topic: Wean me off wxMutexGuiEnter
Replies: 4
Views: 1277

This is taken from the 2003 C++ Standard (http://openassist.googlecode.com/files/C%2B%2B%20Standard%20-%20ANSI%20ISO%20IEC%2014882%202003.pdf) [Note: in some circumstances, C++ implementations implicitly define the default constructor (12.1), copy constructor (12.8), assignment operator (12.8), or d...
by Virchanza
Mon Jun 07, 2010 2:10 pm
Forum: C++ Development
Topic: wxNotebook on MS-Windows 7 : Won't change panel
Replies: 11
Views: 1752

I checked the code that was auto-generated by wxFormBuilder: m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_BOTTOM ); m_panel_socket = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_notebook1->AddPage( m_panel_socket, ...
by Virchanza
Mon Jun 07, 2010 1:57 pm
Forum: C++ Development
Topic: Wean me off wxMutexGuiEnter
Replies: 4
Views: 1277

OK I've been working away trying to get this going. I've written 1 custom event class that is utilised by all 3 notifications that come from my Sniffer thread (the ID of the event is used to identify the particular notification). ID == 0 (Add_MAC_to_list) ID == 1 (Update_IP_List) ID == 2 (Add_Port_t...