Started by domenicomaria ·
2019-04-27 18:02 UTC ·
9 replies · SMF topic #2677
domenicomaria
2019-04-27 18:02 UTC
I use a
picture box
to
show a
linetype
using
dcl-picturebox-drawsolidrect
it normally works
but NEVER works
the first time
when I
show the
form
If I put the function that shows the linetype
in the
ONINITIALIZE defun
it
executes that
function
but
it shows nothing
if i put
the same function
in the
ONPAINT defun
IT LOCKS THE PC ! ! !
it works only
when i
change the
selection
in the
list of
linetypes
domenicomaria
2019-04-27 18:05 UTC
with OBJECT DCL of CHAD WANLESS
with ACAD 2006
the SAME CODE
WORKS !
OT:
I was a FRIEND of CHAD WANLESS
But i have lost any contact with him !
Does somebody knows something about this ?
domenicomaria
2019-04-28 10:00 UTC
what is the SEQUENCE ?
ON INITIALIZE
ON PAINT
and after
is the FORM SHOWN ?
Why
the ON PAINT event
seems to enter
in an INFINITE LOOP
while
the SAME CODE
contained in the ON PAINT defun,
WORKS PERFECTLY
when i CHANGE the SELECTION
in the list of LINETYPES ?
i need to UNDERSTAND WELL
the BEHAVIOR of the ON PAINT event,
because it is very PARTICULAR !
roy_043
2019-04-28 18:52 UTC
The OnPaint event of the pictureBox is triggered after the OnInitialize event of the form.
Maybe this example can help:
http://opendcl.com/forum/index.php?topic=1946.0
domenicomaria
2019-04-28 19:53 UTC
yes
but it is not enough
to understand the behaviour
of my ONPAINT defun . . .
. . .
In my ONPAINT defun
i call a SUB-ROUTINE
. . .
I do ONLY THIS !
. . .
And I do the same
when the selection is changed
in the list of linetypes
. . .
and in this case
it works
. . .
while the same routine
creates an INFINITE LOOP
if I call it from the ONPAINT defun
. . .
Maybe
that it could depend from
dcl-picturebox-drawsolidrect ?
domenicomaria
2019-04-28 20:00 UTC
domenicomaria
2019-04-28 20:07 UTC
however
it does not depend from
dcl-picturebox-drawsolidrect !
I removed it from the sub routine
and I got the same behavior
from the ONPAINT defun :
IT LOCKS ACAD !
domenicomaria
2019-04-28 20:28 UTC
SOLVED !
I removed from the SUB-ROUTINE
called from the ONPAINT defun
these 2 DCL FUNCTIONS :
dcl-control-setbackcolor
dcl-PictureBox-Clear
and I added them
in the ONINITIALIZE defun . . .
...
Is it possible
that these 2 DCL FUNCTIONS
produce another ONPAINT EVENT
and this produces
an INFINITE LOOP ? !
domenicomaria
2019-04-28 20:56 UTC
TRY the ATTACHMENT !
It will LOCK AUTOCAD !
domenicomaria
2019-04-28 21:22 UTC
However
dcl-control-setbackcolor does NOT create any problem ...
while
if we call
dcl-PictureBox-Clear
from the ONPAINT defun
this will LOCK ACAD.
Is this a BUG ?
Maybe NO !
Because there is no sense
to call dcl-PictureBox-Clear
when the ONPAINT event happens.
Because there is nothing to clear !