Loading ...
Sorry, an error occurred while loading the content.
 

How to constraint each set of radiobutton separately?

Expand Messages
  • oohay1_2005
    Problem: when click on any button of 2nd label, buttons of 1st label becomes unchecked. How to constraint each set of radiobutton separately, ie when clicking
    Message 1 of 3 , Dec 5, 2005
      Problem: when click on any button of 2nd label, buttons of 1st label
      becomes unchecked.

      How to constraint each set of radiobutton separately,
      ie when clicking on buttons for 1st label will keep latest selection
      for 1st label and
      when clicking on buttons for 2nd label, keep latest selection for 2nd
      label ?

      use Win32::GUI;

      $MainWin = Win32::GUI::Window->new(
      -name => "MainWwin",
      -size => [ 400, 400 ],
      -pos => [ 100, 100 ],
      );

      my $xpos = 30,
      my $ypos = 60;

      $MainWin->AddLabel (
      -name => 'Label1',
      -text => 'Btn1',
      -left => $xpos,
      -top => $ypos,
      -width => 60,
      -height => 18,
      );


      $MainWin->AddRadioButton (
      -name => "btn1",
      -left => $xpos +30,
      -top => $ypos,
      -text => "1",
      -height => 20,
      -width => 120,
      -align => "left",
      -tabstop => 1,
      -checked => 1,
      );

      $MainWin->AddRadioButton (
      -name => "btn2",
      -left => $xpos + 30,
      -top => $ypos + 15,
      -text => '2',
      -height => 20,
      -width => 120,
      -align => "left",
      -tabstop => 1,
      );

      $MainWin->AddRadioButton (
      -name => "btn3",
      -left => $xpos + 30,
      -top => $ypos + 30,
      -text => '3',
      -height => 20,
      -width => 120,
      -align => "left",
      -tabstop => 1,
      );

      my $xpos = 30,
      my $ypos = 120;
      $MainWin->AddLabel (
      -name => 'Label2',
      -text => 'Btn2',
      -left => $xpos,
      -top => $ypos,
      -width => 60,
      -height => 18,
      );

      $MainWin->AddRadioButton (
      -name => "btn10",
      -left => $xpos +30,
      -top => $ypos,
      -text => "a",
      -height => 20,
      -width => 120,
      -align => "left",
      -tabstop => 1,
      -checked => 1,
      );

      $MainWin->AddRadioButton (
      -name => "btn11",
      -left => $xpos + 30,
      -top => $ypos + 15,
      -text => 'b',
      -height => 20,
      -width => 120,
      -align => "left",
      -tabstop => 1,
      );

      $MainWin->Show();
      Win32::GUI::Dialog();
    • Piotr Kaluski
      This forum is dedicated to Win32::GuiTest, not Win32::GUI. You can find documentation for this module here http://perl-win32- gui.sourceforge.net . You can
      Message 2 of 3 , Dec 6, 2005
        This forum is dedicated to Win32::GuiTest, not Win32::GUI. You can
        find documentation for this module here http://perl-win32-
        gui.sourceforge.net .
        You can find good coverage on controls on msdn. Have a look at:
        MSDN Home > MSDN Library > Win32 and COM Development > User
        Interface > Windows Shell > Windows Controls > Individual Control
        Information

        And the answer to your question is:
        Add -group => 1 option to each button, which is first in each group
        of buttons.

        The code will look like this:

        ...
        ...
        $MainWin->AddRadioButton (
        -name => "btn1",
        -left => $xpos +30,
        -top => $ypos,
        -text => "1",
        -height => 20,
        -width => 120,
        -align => "left",
        -tabstop => 1,
        -checked => 1,
        -group => 1 <--- New option
        );

        ...
        ...
        $MainWin->AddRadioButton (
        -name => "btn10",
        -left => $xpos +30,
        -top => $ypos,
        -text => "a",
        -height => 20,
        -width => 120,
        -align => "left",
        -tabstop => 1,
        -checked => 1,
        -group => 1 <--- New option
        );

        ...
        ...


        --Piotr




        --- In perlguitest@yahoogroups.com, "oohay1_2005" <oohay1_2005@y...>
        wrote:
        >
        > Problem: when click on any button of 2nd label, buttons of 1st label
        > becomes unchecked.
        >
        > How to constraint each set of radiobutton separately,
        > ie when clicking on buttons for 1st label will keep latest selection
        > for 1st label and
        > when clicking on buttons for 2nd label, keep latest selection for
        2nd
        > label ?
        >
        > use Win32::GUI;
        >
        > $MainWin = Win32::GUI::Window->new(
        > -name => "MainWwin",
        > -size => [ 400, 400 ],
        > -pos => [ 100, 100 ],
        > );
        >
        > my $xpos = 30,
        > my $ypos = 60;
        >
        > $MainWin->AddLabel (
        > -name => 'Label1',
        > -text => 'Btn1',
        > -left => $xpos,
        > -top => $ypos,
        > -width => 60,
        > -height => 18,
        > );
        >
        >
        > $MainWin->AddRadioButton (
        > -name => "btn1",
        > -left => $xpos +30,
        > -top => $ypos,
        > -text => "1",
        > -height => 20,
        > -width => 120,
        > -align => "left",
        > -tabstop => 1,
        > -checked => 1,
        > );
        >
        > $MainWin->AddRadioButton (
        > -name => "btn2",
        > -left => $xpos + 30,
        > -top => $ypos + 15,
        > -text => '2',
        > -height => 20,
        > -width => 120,
        > -align => "left",
        > -tabstop => 1,
        > );
        >
        > $MainWin->AddRadioButton (
        > -name => "btn3",
        > -left => $xpos + 30,
        > -top => $ypos + 30,
        > -text => '3',
        > -height => 20,
        > -width => 120,
        > -align => "left",
        > -tabstop => 1,
        > );
        >
        > my $xpos = 30,
        > my $ypos = 120;
        > $MainWin->AddLabel (
        > -name => 'Label2',
        > -text => 'Btn2',
        > -left => $xpos,
        > -top => $ypos,
        > -width => 60,
        > -height => 18,
        > );
        >
        > $MainWin->AddRadioButton (
        > -name => "btn10",
        > -left => $xpos +30,
        > -top => $ypos,
        > -text => "a",
        > -height => 20,
        > -width => 120,
        > -align => "left",
        > -tabstop => 1,
        > -checked => 1,
        > );
        >
        > $MainWin->AddRadioButton (
        > -name => "btn11",
        > -left => $xpos + 30,
        > -top => $ypos + 15,
        > -text => 'b',
        > -height => 20,
        > -width => 120,
        > -align => "left",
        > -tabstop => 1,
        > );
        >
        > $MainWin->Show();
        > Win32::GUI::Dialog();
        >
      • animesh bhowmick
        Hi all I am looking forward to automate GUI application in unix. Looking forward to some suggestion or some other working group. Regards Animesh
        Message 3 of 3 , Dec 7, 2005
          Hi all

          I am looking forward to automate GUI application in
          unix. Looking forward to some suggestion or some other
          working group.

          Regards
          Animesh

          __________________________________________________
          Do You Yahoo!?
          Tired of spam? Yahoo! Mail has the best spam protection around
          http://mail.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.