Jump to content

Mobile Form TitleButton change Caption on Form Show Event ?


andyhill

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.
Link to comment
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,

Link to comment
Share on other sites

×
×
  • Create New...