Jump to content
Alex40

TPopupMenu for Android and iOS not working

Recommended Posts

Hello,

 

I am using Rad Studio 10.3

 

I am currently developing and adapting FMX Android version of already developed FMX Windows Application. In the Application we use TPopupMenu for hidden right click menus on many places. For some reason when MyPopupMenu.PopUp is called the app crashes on Android (Andriud 12 and Android 13). As far as I know it is the same situation with the iOS version which is also in progress.

 

My question is: Is it possible to use TPopMenu for Android and iOS or there si an alternative?

 

Has anybody used this Libray TRichView ? --> https://www.trichview.com/forums/viewtopic.php?p=41518

 

This what I've read there:

 

image.thumb.png.760f0ec2447e481c13acfcd2e52ab6db.png

 

Thank you for your time in advance!

Edited by Alex40

Share this post


Link to post
Guest

It is interesting how NOTHING ever comes easy when trying to code for an Android FMX (and probably iOS) project.  I have been Android coding using FMX for over six years (23 years coding VCL projects).  You fight each and every step.

 

It is interesting that even using Embarcadero's example (https://docwiki.embarcadero.com/CodeExamples/Alexandria/en/FMXTPopupMenu_(Delphi)) to program a simple button/popup menu project does not work.  And the testimony from someone stating in your link "FireMonkey for Android does not suppot TPopupMenu" flies opposite from the Embarcadero link that I listed which is perplexing.

 

Good luck.

Share this post


Link to post

@Alex40

 

For me PopUp works as expected in Android 11 (64bits) / RAD Studio 11.3

  TForm1 = class(TForm)
    Popup1: TPopup;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
    procedure Button1Click(Sender: TObject);
    procedure FormTap(Sender: TObject; const Point: TPointF);
...
implementation

{$R *.fmx}

uses
  FMX.DialogService;

procedure TForm1.Button1Click(Sender: TObject);
begin
  TDialogService.ShowMessage('hello, Im ' + TButton(Sender).Name);
  //
  Popup1.IsOpen := false;
end;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); // desktop 
begin
  if Button = TMouseButton.mbRight then
    Popup1.IsOpen := true; // Embarcadero recomend "IsOpen = true/false"...
end;

procedure TForm1.FormTap(Sender: TObject; const Point: TPointF); // mobile
begin
  Popup1.IsOpen := true;
end;

image.png.0d2e4a49d16b8f5efb967cb5fe3a9b0e.png

 

Edited by programmerdelphi2k
  • Like 1

Share this post


Link to post
45 minutes ago, programmerdelphi2k said:

For me PopUp works as expected

That's an alternative, but the discussion was about whether or not TPopupMenu works.

1 hour ago, TazKy said:

"FireMonkey for Android does not suppot TPopupMenu" flies opposite from the Embarcadero link that I listed

The documentation is incorrect, the advice on the TRichView forum is correct - it's not supported on Android (or iOS)

  • Like 1

Share this post


Link to post
6 hours ago, Alex40 said:

My question is: Is it possible to use TPopMenu for Android and iOS or there si an alternative?

 

for sure this can be seen on Pallete of component ...

 

image.png.b8bff744051bef5bdbc96457de288419.png

 

Edited by programmerdelphi2k

Share this post


Link to post
1 minute ago, programmerdelphi2k said:

for sure this can be seen on Pallete of component ...

Unfortunately, just because it's on the palette when the platform is selected does not mean it works on that platform - it just means the platform attribute is set on the component.

Share this post


Link to post
7 minutes ago, programmerdelphi2k said:

Unfortunately, just because IS IN THE Documentation, does not mean that is true!

Yes, like I said earlier:

53 minutes ago, Dave Nottage said:

The documentation is incorrect

 

  • Like 1

Share this post


Link to post

Thank you all for your replies! 

 

I really wanted to make sure that I am not wasting time in dublicating my logic into alternative components for no reason and that TPopupMenu could work on Android and iOS somehow.

 

From what I concluded I should continue using alternatives.

 

I started with TListbox, but I will give a try to the TPopUp component and will see how it handles all the processes. To me it looks like it is more flexible than the TListBox which is a good sign.

Share this post


Link to post
5 hours ago, Alex40 said:

 I will give a try to the TPopUp component

you can use PopUp (it is a FORM behind scene) with any other control into it, including your TListBox!

Edited by programmerdelphi2k
  • Like 1

Share this post


Link to post
2 hours ago, programmerdelphi2k said:

you can use PopUp (it is a FORM behind scene) with any other control into it, including your TListBox!

Yeah, I got that, thanks,

 

I chose to use buttons directly (as your example) instead of listbox with items. So far TPopUp does work really nice for the purpose I need it. For now I definetely stay with it.

  • Like 1

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

×