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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...