How to get the owner Form of a TsTitleButton ?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #70042
    SzakiLaci
    Participant

    AC version: 14.29

    #70043
    SzakiLaci
    Participant

    I think I have found a way:
    TForm(TsSkinProvider(tsTitleButtons(TsTitleButton(Sender).Collection).Owner).Owner )

    #70045
    Support
    Keymaster

    Hello!
    Maybe it’s enough to use “Self” there?
    I mean:

    procedure TFoForm.sSkinProvider1TitleButtons0MouseUp(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    begin
      SaveMyFormsPosition(Self);
    #70049
    SzakiLaci
    Participant

    No.
    Self = 1 form only!
    That would “work” only, if I repeat that 58x on 58 different form.

    This:
    SaveMyFormsPosition( TForm(TsSkinProvider(tsTitleButtons(TsTitleButton(Sender).Collection).Owner).Owner ) );
    works universally. It was enough to do it once, and add sSkinProvider1TitleButtons0MouseUp on the fly to each runtime-created button.

    Tested.

    #70058
    Support
    Keymaster

    I understand, Ok. Your way is correct too ))

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.