Jump to content

How To Set A Default Button In MessageDlg() And Change The Hover Colour?


Frederick

Recommended Posts

I am using the Neptune theme.

When displaying a Messagedlg() dialogue control with mbYesNo buttons, I would like to set the default button to mbNo. 

Additionally, I would like to display a different colour when the mouse cursor hovers over a button, like FMSoft's customer login form.

How do I do both?

--
Frederick
(UniGUI Complete - Professional Edition 1.90.0.1505)
 

Change Default Button.png

Link to comment
Share on other sites

5 hours ago, Sherzod said:

This old post may help you:

 

I must be doing something wrong here. My code is:-

         UniSession.AddJS('Ext.override(Ext.MessageBox, {defaultButton: 2});');
         messagedlg('Are you sure you want to delete this record?', mtConfirmation, mbYesNo, CheckDelete);
 

and mbYes is still always positioned to by default. Changing the defaultButton value to 1 or 3 makes no difference.

Link to comment
Share on other sites

15 minutes ago, Frederick said:

and mbYes is still always positioned to by default. Changing the defaultButton value to 1 or 3 makes no difference.

Ok, I will check. 

Link to comment
Share on other sites

2 hours ago, Frederick said:

and mbYes is still always positioned to by default. Changing the defaultButton value to 1 or 3 makes no difference.

Can you try this approach for now?

procedure TMainForm.UniButton5Click(Sender: TObject);
var
  btnID: string;
begin
  btnID := 'no'; //"ok", "yes", "no", "cancel"
  UniSession.AddJS('Ext.MessageBox.beforeShow=function(){Ext.MessageBox.defaultFocus=Ext.MessageBox.queryById("'+ btnID +'")};');
  MessageDlg('Dialog2', mtConfirmation, mbYesNo, DCallBack2);
end;

 

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