473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Perl XMLBuilder

Is anyone familiar with Win32::GUI::XMLBuilder? I think this is great for building GUI windows. I'm just learning how to use it and i'm having some problems. i have created my GUI, with my required buttons. now i want to make these buttons active using onClick. So when the button is click, i want to call and execute a separate perl script. Is there a way to do this? I can't even figure out how to close the GUI window when my 'Exit' button is selected. I've been searching the net and looking through books (obviously the wrong books) and can't find it.

Here is a snippet of my code showing the development of the GUI window, label and a couple of buttons in the window:

[HTML]use Win32::GUI::XMLBuilder;
my $gui = Win32::GUI::XMLBuilder->new(*DATA);
Win32::GUI::Dialog;
__END__


<GUI>
<Window name ='W' height='450' width='550' title='Title' left='340' top='220'>
<Font name='Bold_Title'
size='18'
face='Arial'
bold='1'
italic='0'
/>
<Font name='Bold'
size='9'
face='Arial'
bold='1'
italic='0'
/>

<Label name = 'Label'
text='Select Test Case for Execution:'
top='20'
height='$self->{W}->ScaleHeight/2'
align='center'
font='$self->{Bold_Title}'
/>


<Button name = 'Test Case'
text='Execute This Test Case'
top='100'
height='30'
left='50'
width='200'
onClick='sub{Here is where I want to call a perl script to run!!!}'
/>

<Button name = 'Exit'
text='Exit'
top='360'
height='30'
left='240'
width='70'
onClick='sub{Here is where I want to close the GUI window!!!}'
/>

</Window>
</GUI>[/HTML]
Nov 19 '07 #1
4 1572
Never mind...i figure it out!!!
Nov 19 '07 #2
eWish
971 Expert 512MB
If you would please share your solution, so that others can learn from your experience.

--Kevin
Nov 19 '07 #3
Sure, no problem. I wouldn't want anyone else to spend two days trying to figure this out like i did!

Create a subroutine to do what you want the button to execute and then use the 'onClick' to call the subroutine.

In order to run another perl script by clicking a button, it was as simple as using the 'do' in a subroutine. In order to close the main window by clicking the exit button, create a terminate subroutine. Here's a snippet:

[HTML]use Win32::GUI::XMLBuilder;
my $gui = Win32::GUI::XMLBuilder->new(*DATA);

Win32::GUI::Dialog;


sub Test_Case {
do "C:/code.pl";
}

sub Terminate{
return -1;
}

__END__

<Button name = 'Button'
text='Execute This Test Case'
top='300'
height='30'
left='300'
width='200'
onClick= 'Test_Case'
/>

<Button name = 'Exit'
text='Exit'
top='360'
height='30'
left='240'
width='70'
onClick='Terminate'
/>[/HTML]
Nov 19 '07 #4
eWish
971 Expert 512MB
Thank you for posting your solution! I have considered using the WIn32::GUI modules but have yet to do so.

--Kevin
Nov 19 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Mark Wilson CPU | last post by:
This must be easy, but I'm missing something... I want to execute a Perl script, and capture ALL its output into a PHP variable. Here are my 2 files: -------------------------------------...
31
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
13
by: Otto J. Makela | last post by:
I'm trying to install to php the Perl-1.0.0.tgz package (from http://pecl.php.net/package/perl, enabling one to call perl libraries) to a pre-existing Solaris system. Unfortunately, the attempt...
6
by: surfivor | last post by:
I may be involved in a data migration project involving databases and creating XML feeds. Our site is PHP based, so I imagine the team might suggest PHP, but I had a look at the PHP documentation...
4
by: billb | last post by:
I installed a perl extension for PHP to use some perl inside my php primarily because I have perl working with oracle and not php and oracle. So I want to use my old perl scripts, and use the...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.