Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
August 04, 2008 Thread problem | ||||
---|---|---|---|---|
| ||||
Attachments: | 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! |
August 04, 2008 Re: Thread problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to sleek | 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.
|
August 04, 2008 Re: Thread problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to sleek | 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! > > |
August 04, 2008 Re: Thread problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | 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. > > > |
August 04, 2008 Re: Thread problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to sleek | 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: |
August 04, 2008 Re: Thread problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to sleek | 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.
|
August 04, 2008 Re: Thread problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to sleek | 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!
>
>
Hm, in the hope of locating a compiler bug, i tested your code. And it worked for me.
|
August 04, 2008 Re: Thread problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | 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! > Hm, in the hope of locating a compiler bug, i tested your code. And it worked for me. |
August 04, 2008 Re: Thread problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to sleek | 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. |
August 04, 2008 Re: Thread problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | 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. > |
Copyright © 1999-2021 by the D Language Foundation