Jump to content

How do I change Caption property of Prompt, ShowMessage and MessageDlg window?


BobyX

Recommended Posts

With ExtJS 4.2.x I used this way to change Caption:

ShowMessage ('Sample Text');
UniSession.AddJS ('Ext.get ("messagebox-1001_header_hd-textEl"). SetHTML ("My Caption")');

(the way given by Delphi Developer here: http://forums.unigui.com/index.php?/topic/8106-prompt-pencere-basligi-degistirme/&do=findComment&comment=41435)

 

But in the uniGUI 1.0.2.x with ExtJS 6.5.x it does not work, it generates an Ajax error: Ext.Msg.show({title:"New Application",msg:"Sample Text",buttons:Ext.MessageBox.OK});Ext.get("messagebox-1001_header_hd-textEl").setHTML("Your Caption");

Link to comment
Share on other sites

  • 4 years later...
Em 15/03/2018 às 13h23, Sherzod disse:

Oi

 

Tente isso:

...
UniSession.AddJS('Ext.get("messagebox-1001_header-title-textEl").setText("Your Caption")');

Atenciosamente

Hello, any tricks when EnableSynchronousOperations is true?

Link to comment
Share on other sites

1 hour ago, picyka said:

I use the EnableSynchronousOperations property is true, so in this case the message is modal, it wouldn't change the title.

Workaround:

1. MainForm.Script ->

Ext.on('show', function() {
    if (arguments[0].id === "messagebox-1001" && window.msgboxTitle !== "") {
        arguments[0].setTitle(window.msgboxTitle);
    }
});

2. Usage ->

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  JSInterface.JSCode('window.msgboxTitle="New title";');
  MessageDlg('Test', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbOK]);
  JSInterface.JSCode('window.msgboxTitle="";');
end;

 

  • Like 1
Link to comment
Share on other sites

17 minutos atrás, Sherzod disse:

Solução alternativa:

1. MainForm.Script ->

Ext.on('show', function() {
    if (arguments[0].id === "messagebox-1001" && window.msgboxTitle !== "") {
        arguments[0].setTitle(window.msgboxTitle);
    }
});

2. Uso ->

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  JSInterface.JSCode('window.msgboxTitle="New title";');
  MessageDlg('Test', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbOK]);
  JSInterface.JSCode('window.msgboxTitle="";');
end;

 

It works very well, thank you very much.

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...