i have firefox v 1.5, then by changing the line:
-control => "Shell.Explorer.2",
with
-control => "Shell.FireFox",
and it is working the same as before.
in any case i have a problem with the -size option in AxWindow, whether i
choose -size    => [400, 400], or -size    => [10, 10], it remains the same
size of the parent window, also the vertical scroll bars does not appear
unless we choose an option:
-style =>  WS_VISIBLE | WS_VSCROLL | WS_HSCROLL, 
so the axwindow will be in a separate window you can move it.
there is a tutorial by rob may about scrollbars in:
http://blog.robmay.me.uk/search/label/perl-win32-gui
i will study it to see if it is applicable in this situation.
anyway in the html coding we can choose to display pictures to fit to
window, so i have added a checkbox if it is checked then the pictures will
be displayed to fit the window, but in this case the small pics will be
stretched so it will be ugly. so we can manage to display with this option
only if the size of the picture are bigger than the window , i have a vb6
program wich manage this. i need a way to know the size of a picture in
perl.
 i have added a menu also.
for the people who say why we need a webbrowser to display pictures, i say
that the animated pictures are not displayed correctly by most images
viewers , try this picture of an animated  crocroach:
http://img145.imageshack.us/my.php?image=cockroachzm9.gif
only in a webbrowser it is displayed correctly.

the modified program:

use strict;
use warnings;
use Cwd;
use Win32::GUI qw(WS_VISIBLE WS_VSCROLL WS_HSCROLL WS_CHILD
WS_CLIPCHILDREN);
use Win32::OLE;
use Win32::GUI::AxWindow;
sub CSIDL_DRIVES() {17}

# Define the application menu
my @menu_defn = (
    "File"  => "Folder",
    ">OpenFolder" => { -name => "OpenFolder", -onClick => \&OpenFolder}
);
my $menu = Win32::GUI::Menu->new(@menu_defn);
my $dir;
my $OLEControl;
my $pic;
my $desk = Win32::GUI::GetDesktopWindow();
my $dw = Win32::GUI::Width($desk);
my $dh = Win32::GUI::Height($desk);
# main Window
my $Window = new Win32::GUI::Window (
    -title    => "Win32::GUI::AxWindow and Win32::OLE",
    -pos     => [0, 0],
    -size    => [$dw, $dh],
    -name     => "Window",
    -menu  => $menu,
    -vscroll => 1,
    -hscroll => 1,
    
) or die "new Window";
# Create AxWindow
my $Control = new Win32::GUI::AxWindow  (
               -parent  => $Window,
               -name    => "Control",
               -pos     => [126, 0],
               -size    => [400, 400],
               -control => "Shell.Explorer.2",
               
               -style =>  WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL,
               #choose the line below if you want a separate axwindow
               #-style =>  WS_VISIBLE | WS_VSCROLL | WS_HSCROLL, 
               
      
 ) or die "new Control";
# Register Event
$Control->RegisterEvent ("DocumentComplete", "DocumentComplete_Event" );

my $PicList = $Window->AddListbox(
 -name   => "PicList",
 -top    => 0,
 -left   => 0,
 -width  => 125,
 -height => 110,
 -addstyle  => WS_VISIBLE | WS_VSCROLL,

);
my $checkbox = $Window->AddCheckbox(
       -text    => "",
       -name    => "Checkbox1",
       -left    => 3,
       -top     => 150,
       -width   => 30,
       -height  => 30,
      );



#Show application window
$Window->Show();

#Enter event loop
Win32::GUI::Dialog();

#Hide windows on exit
$Window->Hide();
undef $Window;
exit(0);
# Event handler
sub DocumentComplete_Event { 
    
  $OLEControl->{Document}->write($pic); # Write Html
  
} 

sub PicList_Click {
    my $ListSelection = $PicList->SelectedItem();
    my $selectedPic = $PicList->GetString($ListSelection);
    my $picture = $dir . '/' . $selectedPic;
   # Get Ole object
   $OLEControl = $Control->GetOLE();
   $OLEControl->Navigate("about:Blank");  # Clear control
   if($checkbox->GetCheck() != 0 ) { 
 $pic = "<html><body> $picture </body></html>";
} 
else{
$pic = "<html><body> $picture </body></html>";
}
return 0;

}
sub OpenFolder {
       $dir = Win32::GUI::BrowseForFolder(
        -title      => "Select a drive",
        #-folderonly => 1,
        #-includefiles => 1,
        -editbox => 0,
        -root       => CSIDL_DRIVES,
);
$PicList -> Reset(); #erase the contents of PicList
#read the contents of the folder and assign it to @files

opendir DH, $dir or die "Cannot open $dir: $!";
my @files = grep { ! -d } readdir DH;
closedir DH;
#choose only jpg or gif files
my @picFiles = grep /.+\.jpg|gif/,@files;
# work with @files
foreach my $item (@picFiles)
{ 
$PicList->Add($item);
}
return 0;
}

# Main window event handler

sub Window_Terminate {

  # Release all before destroy window
  undef $OLEControl;
  $Control->Release();

  return -1;
}
sub Window_Resize {

  if (defined $Window) {
    my($width, $height) = ($Window->GetClientRect)[2..3];
    $Control->Resize ($width, $height);
  }
}

__END__








Waldemar Biernacki wrote:
> 
> Hello!
> 
> Is it possible to use Firefox instead of IE in these ActiveX components?
> 
> Waldemar
> 
> 
> 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> http://perl-win32-gui.sourceforge.net/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Firefox-instead-IE-tp18594576p18607954.html
Sent from the perl-win32-gui-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to