Jump to content


Photo

Mobile Form TitleButton change Caption on Form Show Event ?

Caption

  • Please log in to reply
3 replies to this topic

#1 andyhill

andyhill

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 346 posts
  • LocationMelbourne Australia

Posted 07 February 2018 - 10:29 PM

I have a Mobile Form (MymForm) that has several Title Buttons.

 

I want to change the Caption of TitleButtons[0] on the Form Show Event - please advise how - thanks.

 

procedure TMymForm.UnimFormShow(Sender: TObject);
begin
 
    if UniMainModule.tblData.Filtered = True then begin
      MymForm.TitleButtons[0].Caption:= 'ABC';
    end else begin
      MymForm.TitleButtons[0].Caption:= 'DEF';
    end;
 
The code above executes without error but makes no difference to the Caption and the original IDE Caption setting remains.

  • 0

Andy


#2 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4969 posts

Posted 08 February 2018 - 05:12 AM

Hi,

 

Can you try this approach for now ?:

 

For example:

procedure TUnimForm1.UnimFormShow(Sender: TObject);
var
  I: Byte;
begin
  I := 0;
  if Self.CloseButton.Visible then
    Inc(I); //closebutton "indx"

  Self.TitleButtons[0].Caption := 'New Title';
  UniSession.AddJS(Self.Name + '.titlebar.getAt('+ IntToStr(I) +').setText("New Title")');
end;

Best regards,


  • 0

#3 andyhill

andyhill

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 346 posts
  • LocationMelbourne Australia

Posted 08 February 2018 - 05:33 AM

Thank you.

 

My CloseButton = 1 so I actually had to make my TitleButton = 2 to work (it appears to be 1 based [not zero based]).


  • 0

Andy


#4 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4969 posts

Posted 08 February 2018 - 05:35 AM

Yes like in this post:

http://forums.unigui...how/#entry51179

 

I tested it on ExtJS 6


  • 0





Also tagged with one or more of these keywords: Caption

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users