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
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 ?
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 !
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
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 ?
see the attachment ...
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 !
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 ? !
TRY the ATTACHMENT !
It will LOCK AUTOCAD !
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 !