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! 


begin 666 test.d


M;VY!9&%P=&5R.PT*:6UP;W)T(&1W="YE=F5N=',N4V5L96-T:6]N179E;G0[

M:61G971S+D)U='1O;CL-"FEM<&]R="!D=W0N=VED9V5T<RY$:7-P;&%Y.PT*
M:6UP;W)T(&1W="YW:61G971S+E-H96QL.PT*:6UP;W)T('1A;F=O+FEO+E-T
M9&]U=#L-
M=&]N('-T87)T4W1O<$)U='1O;CL-" T*("  ('1H:7,H1&ES<&QA>2!D:7-P



M97< 1FEL;$QA>6]U=" I*3L-" T*("  ("  ("!S=&%R=%-T;W!"=71T;VX 
M/2!N97< 0G5T=&]N*'1H:7,L($175"Y055-(*3L-"B  ("  ("  <W1A<G13

M<$)U='1O;BYA9&1396QE8W1I;VY,:7-T96YE<BAN97< 8VQA<W, 4V5L96-T

M*%-E;&5C=&EO;D5V96YT(&5V="D-"B  ("  ("  ("  ('L-"B  ("  ("  
M("  ("  ("!S=&%R=%-T;W!"=71T;VXN<V5T5&5X=" B87=E<V]M92$B*3L-

M.PT*("  ('T-"GT-" T*=F]I9"!M86EN*"D-"GL-"B  ("!A=71O(&1I<W!L
M87D /2!N97< 1&ES<&QA>2 I.PT*("  (&9I;F%L(&%U=&\ ;6%I;E=I;F1O
M=R ](&YE=R!-86EN5VEN9&]W*&1I<W!L87DI.PT*("  (&UA:6Y7:6YD;W<N


M8V H*2D-"B  ("  ("  >PT*("  ("  ("  ("  9&ES<&QA>2YS;&5E<" I


`
end
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! 
 
 
Hm, in the hope of locating a compiler bug, i tested your code. And it 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!
Hm, in the hope of locating a compiler bug, i tested your code. And it 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