www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - Thread problem

reply "sleek" <cslush gmail.com> writes:
I'm trying to manipulate the text on a button in my shell, but no matter 
what I try, I continue to get:

object.Exception: Access Violation

The code I'm attempting to run is attached. Can anyone take a look and shed 
some light on what I'm doing wrong? Thanks! 
Aug 03 2008
next sibling parent reply Frank Benoit <keinfarbton googlemail.com> writes:
sleek schrieb:
 I'm trying to manipulate the text on a button in my shell, but no matter 
 what I try, I continue to get:
 
 object.Exception: Access Violation
 
 The code I'm attempting to run is attached. Can anyone take a look and shed 
 some light on what I'm doing wrong? Thanks! 
 
 

The documentation of SWT says for most widgets: IMPORTANT: This class is not intended to be subclassed. So do not subclass Shell, instead use it as a member variable. But the access violation is caused by accessing a local variable from your startStopButton selection listener. The initComponents method is finished long before the listener is called. So the "startStopButton" variable do no more exist. Make this variable a member var of the MainWindow class.
Aug 03 2008
parent reply "sleek" <cslush gmail.com> writes:
The startStopButton is a member variable. I am just initializing it in the 
initComponents method. Thanks for the info about not sub-classing Shell. I'm 
used to writing Swing code where normally you extend most widgets.

"Frank Benoit" <keinfarbton googlemail.com> wrote in message 
news:g75m35$1jot$1 digitalmars.com...
 sleek schrieb:
 I'm trying to manipulate the text on a button in my shell, but no matter 
 what I try, I continue to get:

 object.Exception: Access Violation

 The code I'm attempting to run is attached. Can anyone take a look and 
 shed some light on what I'm doing wrong? Thanks!

The documentation of SWT says for most widgets: IMPORTANT: This class is not intended to be subclassed. So do not subclass Shell, instead use it as a member variable. But the access violation is caused by accessing a local variable from your startStopButton selection listener. The initComponents method is finished long before the listener is called. So the "startStopButton" variable do no more exist. Make this variable a member var of the MainWindow class.

Aug 03 2008
parent Frank Benoit <keinfarbton googlemail.com> writes:
sleek schrieb:
 The startStopButton is a member variable. 

hm, i missed that. I was too much expecting this problem :) This looks like a compiler bug to me.
Aug 03 2008
prev sibling next sibling parent reply "sleek" <cslush gmail.com> writes:
Aha!  dgListener!!! I did not notice that this existed. Using it seems to 
have solved my problem. Is this documented somewhere on the DWT site?

"sleek" <cslush gmail.com> wrote in message 
news:g75l5i$1i62$1 digitalmars.com...
 I'm trying to manipulate the text on a button in my shell, but no matter 
 what I try, I continue to get:

 object.Exception: Access Violation

 The code I'm attempting to run is attached. Can anyone take a look and 
 shed some light on what I'm doing wrong? Thanks!

 

Aug 03 2008
parent Frank Benoit <keinfarbton googlemail.com> writes:
sleek schrieb:
 Aha!  dgListener!!! I did not notice that this existed. Using it seems to 
 have solved my problem. Is this documented somewhere on the DWT site?
 

Now it is mentioned here: http://www.dsource.org/projects/dwt/wiki/DiffToOriginal#ThingsaddedorchangedinDWT:
Aug 03 2008
prev sibling parent reply Frank Benoit <keinfarbton googlemail.com> writes:
sleek schrieb:
 I'm trying to manipulate the text on a button in my shell, but no matter 
 what I try, I continue to get:
 
 object.Exception: Access Violation
 
 The code I'm attempting to run is attached. Can anyone take a look and shed 
 some light on what I'm doing wrong? Thanks! 
 
 

worked for me.
Aug 03 2008
parent reply "sleek" <cslush gmail.com> writes:
I'll definitely try and take another look at it. I'm using the compiler and 
libraries from the Easy-D install, so maybe that's the issue?

"Frank Benoit" <keinfarbton googlemail.com> wrote in message 
news:g75scg$1v22$1 digitalmars.com...
 sleek schrieb:
 I'm trying to manipulate the text on a button in my shell, but no matter 
 what I try, I continue to get:

 object.Exception: Access Violation

 The code I'm attempting to run is attached. Can anyone take a look and 
 shed some light on what I'm doing wrong? Thanks!

worked for me.

Aug 04 2008
parent reply Frank Benoit <keinfarbton googlemail.com> writes:
sleek schrieb:
 I'll definitely try and take another look at it. I'm using the compiler and 
 libraries from the Easy-D install, so maybe that's the issue?
 

According to http://www.fsdev.net/versions/show/7 DMD 1.030 is included there. This version has a bug with anonymous classes, like that one used in your code. Using DMD 1.033 should solve this. On http://www.dsource.org/projects/dwt/wiki/Requirements I have listed the current supported compiler(s). To update, it is sufficient to overwrite the dmd.exe with the newer version.
Aug 04 2008
parent "sleek" <cslush gmail.com> writes:
Very cool. Thanks for the update. I'll upgrade now

"Frank Benoit" <keinfarbton googlemail.com> wrote in message 
news:g773n1$12uu$1 digitalmars.com...
 sleek schrieb:
 I'll definitely try and take another look at it. I'm using the compiler 
 and libraries from the Easy-D install, so maybe that's the issue?

According to http://www.fsdev.net/versions/show/7 DMD 1.030 is included there. This version has a bug with anonymous classes, like that one used in your code. Using DMD 1.033 should solve this. On http://www.dsource.org/projects/dwt/wiki/Requirements I have listed the current supported compiler(s). To update, it is sufficient to overwrite the dmd.exe with the newer version.

Aug 04 2008