Jump to content
uniGUI Discussion Forums
Sign in to follow this  
andyhill

Mobile Form TitleButton change Caption on Form Show Event ?

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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,

Share this post


Link to post
Share on other sites

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]).

Share this post


Link to post
Share on other sites
Sign in to follow this  

×