1. Matt! I need help making a wxEuphoria add-on library

I stumbled across this post: How to Draw Gradient Buttons and figured it would make a nice addition to wxEuphoria. But I didn't want to just embed the code into the library. Instead, I figured I could build it as an add-on by making my own DLL and wrapper. I've got just about everything done, most of the code is written, the DLL compiles nicely with Watcom, and my new wxGradientButtons display perfectly.

Except, when I assign an event handler for wxEVT_COMMAND_BUTTON_CLICKED, the program crashes with a machine exception when I click the button, and I can't figure out why. All the "button" (which is really a wxWindow) does is create a new event and push it to the event stack, which seems pretty simple. I'm so close on this, I can practically taste it.

void wxGradientButton::OnLeftUp( wxMouseEvent& event ) 
{ 
	if(GetCapture() == this) 
	{ 
		ReleaseMouse(); 
		Refresh(); 
		if ( GetClientRect().Contains(event.GetPosition()) ) 
		{ 
			wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED, GetId()); 
			GetEventHandler()->AddPendingEvent(evt); 
		} 
	} 
} 

Note: You'll have to adjust the WXEUDIR path in the make.bat file to your own wxEuphoria trunk.

wxGradientButton.zip (11 KB)

-Greg

new topic     » topic index » view message » categorize

2. Re: Matt! I need help making a wxEuphoria add-on library

ghaberek said...

Except, when I assign an event handler for wxEVT_COMMAND_BUTTON_CLICKED, the program crashes with a machine exception when I click the button, and I can't figure out why. All the "button" (which is really a wxWindow) does is create a new event and push it to the event stack, which seems pretty simple. I'm so close on this, I can practically taste it.

The key is that you need to add the event object. I took your code and added a GNU configure/Makefile, and uploaded to an hg repo on bitbucket. You can clone it from here:

https://bitbucket.org/mattlewis/wxeugradientbutton

If you have a bitbucket account, let me know, and I'll hook you up.

Matt

new topic     » goto parent     » topic index » view message » categorize

3. Re: Matt! I need help making a wxEuphoria add-on library

mattlewis said...

The key is that you need to add the event object. I took your code and added a GNU configure/Makefile, and uploaded to an hg repo on bitbucket. You can clone it from here:

https://bitbucket.org/mattlewis/wxeugradientbutton

If you have a bitbucket account, let me know, and I'll hook you up.

I knew it would be something simple! And only one line of code at that... thanks for fixing it!

I do not have a bitbucket account. I would be interested though...

-Greg

new topic     » goto parent     » topic index » view message » categorize

4. Re: Matt! I need help making a wxEuphoria add-on library

ghaberek said...
mattlewis said...

The key is that you need to add the event object. I took your code and added a GNU configure/Makefile, and uploaded to an hg repo on bitbucket. You can clone it from here:

https://bitbucket.org/mattlewis/wxeugradientbutton

If you have a bitbucket account, let me know, and I'll hook you up.

I knew it would be something simple! And only one line of code at that... thanks for fixing it!

I do not have a bitbucket account. I would be interested though...

It's a free signup. Let me know if you do...

Matt

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu