Android Question DoEvents Replace

bernardR

Member
Licensed User
Longtime User
Hello,

I call in Activity_Create subs for calculate size of views. Many use DoEvents.
It is important that all are executed before Activity_Resume.
When I replace DoEvents with 'Wait For ...", it works not more.
I joints an sample (See the log)

Is it possible to get same result with 'Wait For' as DoEvents ?
Thanks
 

Attachments

  • doeventsReplace.zip
    6.8 KB · Views: 171

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is important that all are executed before Activity_Resume.
When I replace DoEvents with 'Wait For ...", it works not more.
Calling Sleep or Wait For will cause Activity_Create to be suspended and later resumed. It will only be resumed after Activity_Resume was called.

I call in Activity_Create subs for calculate size of views. Many use DoEvents.
Please post the relevant code.
1. I never seen a case where it is needed.
2. Why must it complete before Activity_Resume?
 
Upvote 0

bernardR

Member
Licensed User
Longtime User
Thanks. StringUtils seems a good solution for calculate without doevents the height of a string.
Is it sure that StringUtils don't use no doEvents inside ?

For calculate the width of a string, use a canvas is not sure (many errors in results).
The only sure method that I know is: Label.width=-2 and use reflector with doEvents (or wait For) for get the width.
Is there an other method without doEvents (or wait For), please ?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…