OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Peter2 on August 09, 2016, 07:36:27 AM

Title: dcl-PictureBox-DrawText not running in "Oninitialize"?
Post by: Peter2 on August 09, 2016, 07:36:27 AM
I have this code to
- load and display a picture (WMF)
- load and display a tooltip
- create a temp-text with dcl-PictureBox-DrawText
- convert the temp-text to image with dcl-PictureBox-StoreImage

Code (autolisp) Select
(progn
    ; a) show image
    (dcl-PictureBox-LoadPictureFile (eval (read WMFViewName)) WMFName T)
    ; b) handle tooltip
    (dcl-Control-SetToolTipTitle (eval (read WMFViewName)) tafel)
    ; c) create temp-text
    (dcl-PictureBox-DrawText (eval (read WMFViewName)) (list (list 5 0 2 5 tafel 0)))
    ; d) store text as Image
    (dcl-PictureBox-StoreImage (eval (read WMFViewName)))
)

It works fine when the dialogue is open and I use buttons and lists and so on. But if I call the code from "Oninitialize", only a) and b) are done. c) (and of course d) does nothing. Is it a limitation of the function?

Thanks

Peter
Title: Re: dcl-PictureBox-DrawText not running in "Oninitialize"?
Post by: owenwengerd on August 09, 2016, 06:41:42 PM
Yes, DrawText writes to the display. If nothing is displayed, there is nowhere for it to write. You might try using OnPaint to delay initialization until the control is visible.
Title: Re: dcl-PictureBox-DrawText not running in "Oninitialize"?
Post by: Peter2 on August 10, 2016, 12:18:04 AM
Quote from: owenwengerd on August 09, 2016, 06:41:42 PM
....You might try using OnPaint to delay initialization until the control is visible.
Thanks for the hint. I tried it and normally it would works, but with 20 controls and dynamic content and different display commands it is more complex then expected. In this case I will search another way ...  ;)