Jump to content

havrlisan

Members
  • Content Count

    31
  • Joined

  • Last visited

Posts posted by havrlisan


  1. You can add TListBoxItem controls to TComboBox, for example:

    procedure TForm1.AddComboBoxItem(const AText: String; const AImageIndex: Integer);
    var
    	LItem: TListBoxItem;
    begin
    	TComboBox1.BeginUpdate;
        LItem := TListBoxItem.Create(TComboBox1);
        LItem.Parent := TComboBox1;
        LItem.Images := TImageList1;
        LItem.ImageIndex := AImageIndex;
        LItem.Text := AText;
        TComboBox1.EndUpdate;
    end;

    TComboBox will use these exactly the same if you were to put strings in TComboBox.Items.

    LItem.Images is a property to which you assign a TImageList control, in which you can add images. By assigning LItem.ImageIndex, you will then use the image you defined at that index inside the TImageList.

     

    Another option is to define an FMX style in TStyleBook and directly put the image there, but that might be redundant for this specific scenario. Unsure of which approach is better in general, but I prefer the latter one as it is more convenient to use in multiple places. Really depends on what you need though.

    • Like 1

  2. On 12/9/2022 at 2:11 PM, programmerdelphi2k said:
    
    type
      TMyGUID = TGUID; // your "alias" that way
    
      TMyHlpToTGUID = record helper for TGUID
        function MyFunc: string;
      end;
    
      TMyHlpToTMyGUID = record helper for TMyGUID
        function MyMyFunc: string;
      end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      x: TMyGUID;
    begin
      x := TMyGUID.Create('123...');
      x.MyMyFunc; // MyMyFunc "hide" MyFunc now... helper to same type-base TGUID!
    end;
    
    { TMyHlpToTGUID }
    
    function TMyHlpToTGUID.MyFunc: string;
    begin
      result := 'Hello';
    end;
    
    { TMyHlpToTMyGUID }
    
    function TMyHlpToTMyGUID.MyMyFunc: string;
    begin
      result := 'World';
    end;
    
    end.

    as "TMyGUID" is, in fact, "TGUID" (yet), then your attributes should works in "TGUID" not in "TMyGUID"

    as showed in your "blog post", the real type is "TGUID", then, you needs works with it, not "TMyGUID"

     

    image.thumb.png.03a6a1938dd765321eb31a36d7e7e1ff.png

    I see, so it is not possible to declare attributes for aliases. Thanks for your answer.


  3. Is it possible to use attributes in these scenarios:

    // First scenario
    [MyAttr]
    TMyGuid = TGuid;
    
    // Second scenario
    [MyAttr]
    TMyDT = TDateTime;

    I found this article that says it's not possible to use attributes on aliases of simple ordinal types, only on actual sub-types by using the type keyword. I'm asking this because I believe declaring my TMyGuid type as a sub-type for TGuid rather than an alias will break a lot of my code. Is there really no way to use attributes on aliases like this?

     

    Update: I realized that changing my declaration to

    TMyGuid = type TGuid;

    will only cause the loss of TGuidHelper. Unfortunately, class helper inheritance is still not available so I will have to rewrite it for my sub-type.


  4. 40 minutes ago, Vince Bartlett said:

    I don't have the same issue but after the last load of updates my A52 5G installed, the Delphi debugger won't break at any breakpoint. The end process works though.


    My A51 (and all the the other Android phones I tried) still work OK.

    I've tried on both RAD Studio 11 and 11.1. 

    11.1 did some odd things, I disabled USB debugging, reconnected and it asked about trusting the computer. Then it decided it wasn't in developer mode any more so I had to re-enable it.

    Wondering if the Samsung updates broke something?

    Perhaps. I tried setting up a wireless debugging option, maybe that's what messed up the configuration. Weird behavior, but I believe I tried everything except factory reset.


  5. Hi. As the title says, I cannot debug any Delphi FMX application on my Android phone. I'm using the latest Delphi version (Alexandria, Update 1), and my phone is Samsung A52s. When I try to run in debug mode, the app installs, a black screen shows up on the phone, and RAD studio layout transforms to Debug layout. Two outcomes may happen after that:

    1. I get the exception Stop(17), which leads me to CPU view and a call stack containing only "clone" and "bionic_clone",
    2. The app stays entirely black, and either nothing happens or RAD studio disconnects after a minute of being in the debug mode.

    On further investigation, I realized that if I set a breakpoint on Application.Initialize, it is never triggered. Also, if I set a breakpoint while the debugger is attached, RAD studio freezes for ~10 seconds, and after it unfreezes the debugger disconnects (while the app is still running on the phone, still as a black screen).

     

    Useful info:

    • The app runs completely normal when opened without the debugger.
    • I am able to debug blank apps with Android Studio.
    • I tried using a different SDK version.
    • I have another phone, Samsung A5 (2017) that can be used with the debugger (but it randomly restarts when debugging, hence unusable).
    • A52s uses Android 12, while A5 is Android 8 (Oreo).

     

    I also attached logs from logcat, that are filtered for anything that matches with the app name 'com.embarcadero.BetterProgress'.

     

    I don't know what other information may be of use, so if I missed something feel free to write it in the comments. Any idea is appreciated!

    android-log.txt

×