RadioButtons checked status not updating on invisible form

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #36064
    DarrenB
    Participant

    Hi Serge,

    been programming today for a long, long time but I've been running round in circles with this problem for about 6 hours now. I thought it was something I'd missed but now I'm not so sure.

    I have included a demo file, the instructions for reproducing the error(?) are included in a memo box on form1.

    Basically

    Set up a new app, form1 and form2. Add the usual skinmanager,skinprovider to form1.

    Add 3 buttons to form1.

    Button1.caption 'Make Board2 Invisible'

    Button2.caption 'Change form2 Radiobuttons'

    Button3.caption 'Show Form2'

    Code for form1 should look basically like this

    Quote:
    procedure TForm1.FormShow(Sender: TObject);

    begin

    form2.show;

    end;

    procedure TForm1.sButton1Click(Sender: TObject);

    begin

    form2.Hide;

    end;

    procedure TForm1.sButton2Click(Sender: TObject);

    begin

    form2.sRadioButton1.Checked := true;

    form2.sRadioButton2.Checked := false;

    end;

    procedure TForm1.sButton3Click(Sender: TObject);

    begin

    form2.show;

    end;

    Add 2 panels to form2, and on each panel place a sradiobutton. Set sradiobutton1.checked to true, and sradiobutton2.checked to false;

    Code for form2 should look basically like this

    Quote:
    procedure TForm2.sRadioButton1Click(Sender: TObject);

    begin

    sRadioButton2.Checked := false;

    end;

    procedure TForm2.sRadioButton2Click(Sender: TObject);

    begin

    sRadioButton1.Checked := false;

    end;

    How to Reproduce Error(?)

    Click on RadioButton2 on form2.

    Notice the settings for the

    radiobuttons.

    Now Click 'Make Board2

    Invisible'

    Then Click 'Change form2

    RadioButtons;

    Then Click 'Show Form2'

    The radiobuttons' checked value

    for did not change!!!

    If this is an error and not just me being very tired then it's an important error because at the moment I can't go any further in my main app.

    AlphaSkins 8.53, Delphi XE, Vista 64bit

    Regards,

    Darren

    #51630
    CheshireCat
    Participant

    Hello Darren,

    if you make Form2 invisible, RadioButtons should have no focus!

    Code:
    procedure TForm2.FormHide(Sender: TObject);
    begin
    ActiveControl := nil;
    end;

    I don't know it's an error, but I observe this behavior since I use delphi …

    #51634
    DarrenB
    Participant

    Good morning Sascha, I hope u r well 🙂

    Thanks for your reply… I did not know what you said! I have inserted an

    ActiveControl := nil;

    In all the relevant positions in my main application and the advice you offered seems to be perfect. Certainly the error I was having last night is now fixed 🙂

    Thankyou 😀

    Darren

    #51635
    CheshireCat
    Participant
    'DarrenB' wrote:

    I did not know what you said!

    Sorry for my bad english :blush:

    #51636
    DarrenB
    Participant
    'CheshireCat' wrote:

    Sorry for my bad english :blush:

    lol Sascha nooooo your english was perfectly understandable… I just meant I did not know that I should put the ActiveControl:=nil into the form hide event!!!!

    In this case, my English was bad!!!! lol 😉

    #51637
    CheshireCat
    Participant

    Ok Darren, that calms me 🙄

    'DarrenB' wrote:

    I just meant I did not know that I should put the ActiveControl:=nil into the form hide event!!!!

    What I meant to say:

    Radio buttons are activated when gets the focus. If the active control is a radio button when the form changes from hidden to visible, Windows sends a SetFocus message and the button is activated. This is not a Alpha Controls bug but a questionable behavior of Windows.

    #51638
    DarrenB
    Participant

    Useful to know, thanks Sascha 🙂

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.