Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6897667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:11:53+00:00 2026-05-27T07:11:53+00:00

How to add a control in a window at run time using perl win32::GUI?

  • 0

How to add a control in a window at run time using perl win32::GUI?
I have a button control in my window. I need to create a checkbox control in the same window, while I am clicking the button.
I have written the code as mentioned in below, which is not working also.
Please give the correct way to proceed to adding controls at run time using perl Win32::GUI

use strict;
use Win32;
use Win32::GUI;

my $win=Win32::GUI::Window->new(
        -name => 'wino',
        -text => 'window',
        -left => 375,
        -top  => 400,
        -width =>380,
        -height =>260,
);
my $but=$win->AddButton(
      -text=>"Add Control",
      -onclick=>\&add_control,
);

 $win->Show();
 Win32::GUI::Dialog();

 sub add_control(){

   my $mchk=$win->AddCheckbox(
    -text=>"run_time_con",
    -pos=>[180,145],
   );

   $mchk->Show();

 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:11:53+00:00Added an answer on May 27, 2026 at 7:11 am

    Your problem isn’t the code which adds the control, it’s the fact that the button click event isn’t wired up properly. See the documentation.

    Try this instead:

    use warnings;
    use strict;
    use Win32;
    use Win32::GUI();
    
    my $win=Win32::GUI::Window->new(
            -name => 'wino',
            -text => 'window',
            -left => 375,
            -top  => 400,
            -width =>380,
            -height =>260,
    );
    
    my $but=$win->AddButton(
          -name => "Button1",
          -text=>"Add Control"
    );
    
    $win->Show();
    Win32::GUI::Dialog();
    
    sub Button1_Click(){
       my $mchk=$win->AddCheckbox(
        -text=>"run_time_con",
        -pos=>[180,145],
       );
    
       $mchk->Show();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a System.Windows.Forms.Button control, and I want to add a hover-text explanation of
Often time I need to add a control to a dialog after the dialog
I need to dock a WinForms user control at run time but I'm encountering
When using custom template for Login control , if we add control with ID
Hi I have a usercontrol which includes some JavaScript, if I add the control
I need to add an UISlider control in my iphone application. That should look
I'm using this code to add an item to the code window right click
I have a custom user control that fires an exception when trying to add
I have just started to create a user control realising that I want a
Using the Silverlight 4 toolkit chart control, I am trying to create a chart

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.