Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 06/21/23 in all areas

  1. Stefan Glienke

    Localization of constant arrays - best practice?

    If you don't need language swapping while the application is running then go with the const array using resourcestrings. I say so because the const array is initialized on startup with the localized values from the resourcestrings. If you change language later they will not change.
  2. David Heffernan

    How to Sort TStringList ?

    https://stackoverflow.com/questions/5134712/how-to-get-the-sort-order-in-delphi-as-in-windows-explorer
  3. Remy Lebeau

    How to Sort TStringList ?

    Yes, simply use TStringList.CustomSort() to sort the strings however you want, eg: function MySortFunc(List: TStringList; Index1, Index2: Integer): Integer; begin Result := StrToInt(Copy(List[Index2], 4, MaxInt)) - StrToInt(Copy(List[Index1], 4, MaxInt)); end; ... var SL: TStringList; SL := TStringList.Create; ... SL.Add('ABC10'); SL.Add('ABC1'); SL.Add('ABC2'); SL.Add('ABC21'); SL.CustomSort(@MySortFunc); ... SL.Free;
  4. Alex40

    TPopupMenu for Android and iOS not working

    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.
  5. Stefan Glienke

    Localization of constant arrays - best practice?

    That "works" (i.e. you wont get a GPF) because typed consts are no real consts but rather read-only variables (as in you cannot directly assign to them regularly). But I am sure this will cause a memory leak - a static one but ReportMemoryLeaksOnShutdown should complain about it.
  6. programmerdelphi2k

    TPopupMenu for Android and iOS not working

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

    VCL Wrap

    TSuperButton = class(TButton) ... end; TButton = TSuperButton // ! the trick Tform1 = class(TForm) btn: TButton; // <- will be TSuperButton in fact Type reassignment trick
  8. {$IFOPT R+}{$DEFINE RANGECHECKS_ON}{$R-}{$ENDIF} TempInt := TempInt * 11; {$IFDEF RANGECHECKS_ON}{$UNDEF RANGECHECKS_ON}{$R+}{$ENDIF}
  9. FPiette

    VCL Wrap

    If you want access to the properties and events at design time, there is no other way than creating and installing a new component having those properties and events. If you want access the properties and events only at runtime, then no need to create a component. Just create a new class deriving from some ancestor and add the properties and events.
  10. programmerdelphi2k

    Line number at build/compile time??

    @Ian Branch you can try assign "AssertErrorProc" used by system to get some info on exception... here some samples https://stackoverflow.com/questions/7214213/how-to-get-line-number-at-runtime
  11. Dave Nottage

    TPopupMenu for Android and iOS not working

    Yes, like I said earlier:
  12. Dave Nottage

    TPopupMenu for Android and iOS not working

    That's an alternative, but the discussion was about whether or not TPopupMenu works. The documentation is incorrect, the advice on the TRichView forum is correct - it's not supported on Android (or iOS)
  13. programmerdelphi2k

    TPopupMenu for Android and iOS not working

    @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; screen-20230620-155343.mp4
  14. I'm sorry, I am not getting the meaning of your comment. To clarify, my statement was sarcasm. I am not literally in a state of anticipation about the results of AI training off its own questionable output.
  15. I can't imagine a valid reason to ask someone their gender or race on Stack Overflow. Oh, I'm sure people who like to stir up strife would love to have those data points from which to prove anything they like, but there is no good reason to ask me my gender or race while I use SO or respond to their surveys, period.
  16. Brandon Staggs

    SDI <-> MDI forms

    You would use a docking system instead which allows the panels to me moved and docked like the Delphi IDE does. My application works this way. (Bottom-right shows tabs for panels that can be grabbed and re-docked.) This video shows some of that in action.
×