What is the difference between app.CreateImage and app.AddImage?

67 views
Skip to first unread message

faugnxxx

unread,
Sep 7, 2021, 4:42:00 AM9/7/21
to DroidScript
and when is the best time to use for each?

Steve Garman

unread,
Sep 7, 2021, 5:11:56 AM9/7/21
to DroidScript
Until quite recently, the only way to create a control and add it to a layout was 

  img = app.CreateImage( "/Sys/Img/Droid1.png" )
  lay.AddChild( img )

Those two lines can now be replaced by the single line

  img = app.AddImage( lay, "/Sys/Img/Droid1.png" )

The latter is significantly more efficient than the older method and we recommend using it in most cases for new apps.
The main time that CreateImage is useful is if for some reason you are creating the image when the layout is not ready to receive the image

This does not just apply to images but to all visible controls
Reply all
Reply to author
Forward
0 new messages