How to refresh a window using Win32::GUI

From: omoore (redneck13_at_hotmail.com)
Date: 08/11/04

  • Next message: omoore: "Re: How to refresh a window using Win32::GUI"
    Date: 11 Aug 2004 12:48:40 -0700
    
    

    I am just learning Win32::GUI. I created a simple window with a
    checkbox, a label, and a textfield. Initially, the label and textfield
    are disabled. What should happen is they should become enabled if you
    click the checkbox. I cannot figure out how to do this. As you can see
    from the code below, I tried creating a Click event to set the
    variable so that the label and textfield would be enabled, but
    apparently, I have to redraw or refresh the window somehow. Can anyone
    please help?

    --------------Code follows-----------------------

    use Win32::GUI;
    $Display=1;
    $main = Win32::GUI::DialogBox->new(
        -name => 'Main',
        -width => 250,
        -height => 100,
    );
    $main->AddCheckbox(
            -name => 'CheckBox1',
            -width => 225,
            -left => 10,
            -top => 10,
            -tabstop => 1,
            -disabled => 0,
            -visible => 1,
            -text => 'Check this box to enable the next section');
    $main->AddLabel(
            -name => 'label1',
            -left => 30,
            -top => 30,
            -disabled => "$Display",
            -text => "Type something here");
    $main->AddTextfield(
            -name => 'textbox1',
            -width => 175,
            -height => 20,
            -left => 28,
            -top => 45,
            -tabstop => 1,
            -disabled => "$Display",
            -visible => 1);
    $main->Show();
    Win32::GUI::Dialog();
    sub CheckBox1_Click {
            if($Display==1){
                    $Display=0}
            else{$Display=1}
    }
    sub Main_Terminate {
            -1;
    }


  • Next message: omoore: "Re: How to refresh a window using Win32::GUI"

    Relevant Pages