Jump to content
limelect

Just knowledge

Recommended Posts

I am using this site for knowledge.

http://aziga.x10.mx/delphi/index.php?option=com_content&view=article&id=28&Itemid=33

As you can see

  // call static function
    ShowMessage (JStringToString (TJSquareRoot.JavaClass.DisplayDescription));

    a_square_root := TJSquareRoot.Create;
    a_square_root.precision := 3;
    ShowMessage (JStringToString (a_square_root.findSquareRoot (2)));

 

first information then result. But i get first result then information.

 

P.s there are some mistake in SquareRoot.pas on the site 

 

Any knowledge will help 

SquareRoot.jar

Edited by limelect

Share this post


Link to post

Not sure is this may cause any issues as you describe, but the free version seems to accept only Android namespaces.

Quote

Java2Pas

 
Java2Pas is a converter to create Delphi .pas source code files from android .class or .jar files. The commercial version allows converting classes from outside the android namespace.

http://www.fmxexpress.com/utility-to-generate-java-android-class-and-jar-file-interfaces-for-delphi-xe5-firemonkey/

 

Are you using the payed version ?

Edited by Rollo62

Share this post


Link to post

@Rollo62No only free. But still it should not matter. As i call 

ShowMessage (JStringToString (TJSquareRoot.JavaClass.DisplayDescription));

first. Should it not show first ?

 why do you think it matters?

To make jar i used  C:\Program Files\Java\jdk1.8.0_05\bin>jar.

The Java2Pas i used the source in the demo. To dbl check

i did my own and got the same result except that the demo

added   

procedure RegisterTypes;
begin
TRegTypes.RegisterType ('SquareRoot.JSquareRoot', TypeInfo(SquareRoot.JSquareRoot));
end;

initialization
RegisterTypes;
 

Share this post


Link to post
2 hours ago, limelect said:

first information then result. But i get first result then information.

If application is running on Android, message dialog on that OS is asynchronous. Meaning, they do not block code execution.

 

What happens at run-time, I think is;

First dialog displayed first, code continue to execute, second dialog displayed second.

However, as second is displayed as the last message, it appeared on top of all others.

Share this post


Link to post

@ertank

What you say that if i have 3 or 4  ShowMessage in the same procedure the last will show first ?

I wander if this is the explanation.

what you say that there is kind of a first in last out ?

I need more of a theoretical information to be sure.

Share this post


Link to post

Add a TMemo on your form.

When showing a message, add a line on memo.

You will see that order of messages displayed will be same as your code order.

You will see messages displayed will be reversed.

This is because each message dialog displayed on top of existing one

11 minutes ago, limelect said:

What you say that if i have 3 or 4  ShowMessage in the same procedure the last will show first ?

Yes, just test it.

Share this post


Link to post

I added 

   for I :=  0 to 3 do
    ShowMessage (inttostr(i));
and it start from 3 all the way up

But why ? this is the basic question?

Edited by limelect

Share this post


Link to post

Ok found this

http://docwiki.embarcadero.com/Libraries/Rio/en/FMX.Dialogs.ShowMessage

 

ShowMessage Behaves Differently On Different Platforms

On desktop platforms, ShowMessage behaves synchronously. The call finishes only when the user closes the dialog box.
On mobile platforms, ShowMessage behaves asynchronously. The call finishes instantaneously, it does not wait for the user to close the dialog box.

If you want to force a specific behavior across different platforms, use IFMXDialogServiceAsync.ShowMessageAsync or IFMXDialogServiceSync.ShowMessageSync from the FMX.Platform unit.

That mite explain

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×