|
From: pof <jd3...@gm...> - 2017-01-10 20:44:32
|
Le 09/01/2017 à 23:35, JVZ a écrit :
> On Mon, 9 Jan 2017 22:54:47 +0100
> pof <jd3...@gm...> wrote:
>
>> Dear all,
>>
>> I have got a FXMessageBox that runs modally using the following code line:
>> if
>> (MBOX_CLICKED_YES==FXMessageBox::question(this,MBOX_YES_NO,"Information",""Connection
>> failed!\nDo you want to remove the network access from the settings?"))
>> m_bIsNetworkAccessAuthorized = false;
>>
>> The focus defaults to the YES button and I would like to set the default
>> to the NO button.
>> Is there an easy way to do that?
> Well,
>
> If you use the convenience functions, like:
>
> if(FXMessageBox::question()==ID_CLICKED_YES){
> }
>
> then of course its all canned, and you can't change anything.
>
> If you subclass FXMessageBox, your subclass's constructor could obtain the
> pointers to the children, and set the focos on a different child.
>
> In the case of MBOX_YES_NO, you're looking at:
>
> // horizontal frame containing buttons is last child of FXMessageBox
> FXWindow* buttons=getLast();
>
> // No-button is last child of FXHorizontalFrame
> FXWindow *nobutton=buttons->getLast();
>
> // Set focus on it
> nobutton->setFocus();
>
>
> Hope this helps,
>
>
> -- JVZ
>
>
>
>
>
> +----------------------------------------------------------------------------+
> | Copyright (C) 16:00 01/ 9/2017 Jeroen van der Zijp. All Rights Reserved. |
> +----------------------------------------------------------------------------+
Dear Jeroen,
this is exactly what I was looking for.
Still I am wondering whether there would be a possibility to modify the
FXMessageBox API in order to add such possibility in the original class.
Thanks anyway.
JD
|