Change the default button at the message box  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
prasantha
User
Posts: 43
Joined: Fri Jun 24, 2022 8:15 am

Change the default button at the message box

Post by prasantha »

When i show a message box with "yes", "no" buttons, It shows the message box with Yes button is selected.
image.png
image.png (54.52 KiB) Viewed 1115 times
.

But I need to open the message box with "No" button is selected.
Can anyone let me know how to changed the default button at the message box?
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Change the default button at the message box

Post by zarkogajic »

Hi,

https://sdkhelp.pdf-xchange.com/view/PXV:UIX_MsgBoxConfig

With nDefautItemID = UIX_No

-žarko
prasantha
User
Posts: 43
Joined: Fri Jun 24, 2022 8:15 am

Re: Change the default button at the message box

Post by prasantha »

Thank you for your response. I tried it using below code
public void DialogQuestionYesNo(PXV_Inst inst, int defaultButton, string message, string title, uint wHandle, string header = "")
{
DialogResult result;

int flags = (int)(UIX_MsgBoxStyleFlags.UIX_MsgBox_IconQuestion |
UIX_MsgBoxStyleFlags.UIX_MsgBox_YesNo |
UIX_MsgBoxStyleFlags.UIX_MsgBox_NoWndClose |
UIX_MsgBoxStyleFlags.UIX_MsgBox_AppModal);

UIX_MsgBoxConfig pConfig = new UIX_MsgBoxConfig();
pConfig.nDefautItemID = (int) UIX_MsgBoxResult.UIX_No;
pConfig.nStyle = flags;
pConfig.pTitle = title;
pConfig.pHeader = header;
pConfig.pText = message;
pConfig.hWndParent = wHandle;

int pOptionState = 0;
int pSelectedRadioID = 0;
string ppEditText = "";

// var _dlgRes = inst.ShowMsgBox(message, title, header, wHandle, flags);

var dlgRes = inst.ShowMsgBoxEx(ref pConfig, out pOptionState, out pSelectedRadioID, out ppEditText);

}

This does not display the message box.
Can you please let me know what is missing here?
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Change the default button at the message box  SOLVED

Post by zarkogajic »

Hi,

pConfig.nSize = SizeOf(UIX_MsgBoxConfig);

-žarko
prasantha
User
Posts: 43
Joined: Fri Jun 24, 2022 8:15 am

Re: Change the default button at the message box

Post by prasantha »

Thank you!, it works as expected
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Change the default button at the message box

Post by zarkogajic »

:)

p.s.
Please mark as "solved".

-žarko
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Change the default button at the message box

Post by TrackerSupp-Daniel »

:)
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Post Reply