1) the UpDown appears to attach to whatever control preceded it 
2) I am not 100% sure, but the updown control is used to modifying
numberlike thingies, not text.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cmctl29
8/html/vbobjupdowncontrol.asp

It looks like there are also some properties that may not be exposed,
notably, the Increment property to control the step range between pos
values.

It also appears that we cannot set pos, etc during creation (from
GUI.pm):

 
########################################################################
###
    # (@)METHOD:new Win32::GUI::UpDown(PARENT, %OPTIONS)
    # Creates a new UpDown object;
    # can also be called as PARENT->AddUpDown(%OPTIONS).
    #
    # Class specific B<%OPTIONS> are:
    #   -align => left,right
    #   -nothousands => 0/1
    #   -wrap => 0/1
    #   -horizontal => 0/1
    #   -autobuddy => 0/1
    #   -setbuddy => 0/1
    #   -arrowkeys => 0/1



Joe Frazier, Jr.
Senior Support Engineer

Peopleclick Service Support
Tel:  +1-800-841-2365
E-Mail: [EMAIL PROTECTED] 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Francesco Rizzi
> Sent: Monday, September 13, 2004 11:40 AM
> To: perl-win32-gui-users@lists.sourceforge.net
> Cc: Francesco Rizzi
> Subject: [perl-win32-gui-users] HELP, please, on UpDown 
> control and textfield
> 
> Hi there.
> 
> I've just started using the Win32::GUI library, so pardon me 
> if this turns out to be a newbie question.
> 
> I'm having problems with the UpDown control.
> Here's what I'd like to end up with:
> 
> a dialog with a status bar, a text field, an UpDown control 
> regulating the text field, and a Close button. The script 
> will do more stuff (and could even run without a GUI). It 
> should update the status bar indicating what it is doing, and 
> also add lines to the textfield as it goes. The Close button 
> should be disabled as the script does all it needs to do. 
> When the script has done all it needs to do, the Close button 
> is enabled so that the user can close the dialog.
> 
> Here's what I have so far:
> almost everything I need. In particular, I have the script 
> creating, showing, and updating all the GUI as it needs, and 
> passing control to the GUI when it is done. 
> This is the
> listing with all of this working *BUT no UpDown control*: I 
> call this test.pl
> 
> #!/usr/bin/perl
> 
> use Win32;
> use Win32::GUI;
> use strict;
> use warnings;
> 
> my $GUI = 1;
> my $mainWindow;
> my $mainStatusBar;
> my $txtLog;
> 
> MAIN:
>     LOG("test started");
> 
>     InitGUI()
>        if $GUI;
>     $mainStatusBar->Text("test initialized.")
>        if $GUI;
> 
>     LOG("Will do 100 cycles.");
>     DoSomething(100);
> 
>     $mainWindow->btnClose->Enable();
>     my $exitCode = Win32::GUI::Dialog();
>     LOG("Dialog cycle returned control to MAIN with exit code 
> '$exitCode'.");
> 
>     exit(0);
> 
> sub InitGUI
>     {
>     LOG("InitGUI started.");
> #Main Window, with status bar, Log textfield, and Close button:
>     $mainWindow = new Win32::GUI::DialogBox(
>                                         -text => "Test",
>                                         -name => "MainWindow",
>                                         -pos  => [ 200, 400 ],
>                                         -size => [ 600, 500 ]
>                                         )
>     or ERROR("Could not initialize main window.");
>     LOG("Main Window initialized.");
>     $mainStatusBar = new Win32::GUI::StatusBar(
>                                               $mainWindow,
>                                               -name    => 
> "mainStatusBar",
>                                               )
>     or ERROR("Could not initialize main window (status bar).");
>     $mainStatusBar->Text("Initializing");
>     LOG("Status Bar added.");
>     $txtLog = new Win32::GUI::Textfield(
>                                         $mainWindow,
>                                         -name       => "txtLog",
>                                         -pos        => [10, 10],
>                                         -size       => [550, 350],
>                                         -disabled   => 0,
>                                         -visible    => 1,
>                                         -multiline  => 1,
>                                         -readonly   => 1,
>                                         -text       => "Log Started"
>                                         )
>     or ERROR("Could not initialize main window (log textfield).");
>     LOG("Log Textfield added.");
>     $mainWindow->AddButton(
>                           -name      => "btnClose",
>                           -pos       => [10, 400],
>                           -size      => [80, 20],
>                           -text      => "Close",
>                           -disabled  => 1,
>                           -cancel    => 1,
>                           -default   => 1
>                             )
>     or ERROR("Could not initialize main window (Close button).");
>     LOG("Close button added.");
> 
>     LOG("All GUI elements initialized.");
> 
>     $mainWindow->Show();
>     LOG("Showing main window.");
>     my $exitCode = Win32::GUI::DoEvents();
>     LOG("DoEvents cycle returned control to InitGUI with exit 
> code '$exitCode'.");
>     }
> 
> sub TerminateGUI
>     {
>     print STDERR "Terminating GUI.\n";
>     return -1;
>     }
> 
> sub btnClose_Click()
>     {
>     print STDERR "Close button clicked.\n";
>     return TerminateGUI();
>     }
> sub MainWindow_Terminate()
>     {
>     print STDERR "Main Window Terminated.\n";
>     return TerminateGUI();
>     }
> 
> sub DoSomething
>     {
>     my $numCycles = shift;
>     LOG("DoSomething($numCycles).");
>     for(my $i = 0; $i<$numCycles; $i++)
>        {
>        LOG("Doing something $i");
>        }
>     LOG("Done $numCycles cycles.");
>     }
> 
> sub LOG
>     {
>     my ($package, $filename, $line) = caller;
> 
>     if($GUI and $txtLog)
>        {
>        my $msg = $_[0];
>        $msg =~ s/[^\r]\n/\r\n/ms;
>        $msg.="\r\n"
>           unless $msg =~ /\r\n$/ms;
> 
>        $txtLog->Text($txtLog->Text().$msg);
>        Win32::GUI::Update($mainWindow);
>        }
> 
>     print "Test info:", scalar localtime(), ":", @_, "\n";
>     }
> 
> sub WARN
>     {
>     my ($package, $filename, $line) = caller;
>     if($GUI and $txtLog)
>        {
>        my $msg = $_[0];
>        $msg =~ s/[^\r]\n/\r\n/ms;
>        $msg.="\r\n"
>           unless $msg =~ /\r\n$/ms;
> 
>        $txtLog->Text($txtLog->Text().$msg);
>        Win32::GUI::Update($mainWindow);
>        }
>     print STDERR "Test warning:", scalar localtime(), ":line 
> $line in package $package:", @_, "\n";
>     }
> 
> sub ERROR
>     {
>     my ($package, $filename, $line) = caller;
>     if($GUI and $txtLog)
>        {
>        my $msg = $_[0];
>        $msg =~ s/[^\r]\n/\r\n/ms;
>        $msg.="\r\n"
>           unless $msg =~ /\r\n$/ms;
> 
>        $txtLog->Text($txtLog->Text().$msg);
>        Win32::GUI::Update($mainWindow);
>        }
>     $mainStatusBar->Text("ERROR !")
>        if $GUI and $mainStatusBar;
>     print STDERR "Test error:", scalar localtime(), ":line 
> $line in package $package:", @_, "\n";
>     print STDERR "Test terminated with error.\n";
>     exit(1);
>     }
> #===
> 
> I then created test2.pl, which is Identical, but I've added 
> the following lines in InitGUI,
>     $upDown = new Win32::GUI::UpDown(
>                                      $mainWindow,
>                                      -name    => "upDown"
>                                      )
>     or ERROR("Could not initialize main window (Up/Down control.");
>     LOG("Up/Down control added.");
>     $upDown->Buddy($txtLog);
> Immediately preceeding the line
>     LOG("All GUI elements initialized.");
> 
> What is happening with this one is that:
> the close button text is changed to '0' (zero); when the GUi 
> gets control from the script, if I press the up or down 
> arrows, the text in the textfield is changed to a number 
> (from 0 to 100, which seems to be roughly the range).
> 
> Any suggestions in regard?
> 
> Thanks in advance for the time,
> F.O.R.
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one 
> of 170 Project Admins to receive an Apple iPod Mini FREE for 
> your judgement on who ports your project to Linux PPC the 
> best. Sponsored by IBM. 
> Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php 
> _______________________________________________
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> 
> 

Reply via email to