dcl-PictureBox-DrawText not running in "Oninitialize"?

Started by Peter2 · 2016-08-09 14:36 UTC · 2 replies · SMF topic #2404

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

(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
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.
author=owenwengerd link=topic=2404.msg12010#msg12010 date=1470793302 wrote:
....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 ...  ;)