It is a Win32::GUI::XMLBuilder application, so in a sense it is also a Win32::GUI application. The menu/tool bar is done using a Rebar Band and a Toolbar control. You can see the source code by downloading the niPerl distribution and examining the file c:\niPerl\nibin\podview.wgx. Here is a rough sketch of what is happening..

<Rebar top='0' bandborders='1' pushstyle='exec:RBS_BANDBORDERS'>
<Band minheight='24' minwidth='200' width='200' style='exec:RBBS_GRIPPERALWAYS'>
  <Toolbar height='30' name='TB' onButtonClick='sub {
    %P%->TrackPopupMenu(
     $self->{"M$_[1]"},
     $_[0]->AbsLeft + ($_[0]->GetRect($_[1]))[0],
     $_[0]->AbsTop + ($_[0]->GetRect($_[1]))[3]);
   }'/>
   <WGXExec><![CDATA[
    $self->{TB}->SetBitmapSize(0, 0);
    $self->{TB}->Padding(10, 8);
    $self->{TB}->AddString("File");
    ...
   $self->{TB}->AddString("Help");
$self->{TB}->SetStyle(TBSTYLE_LIST|TBSTYLE_FLAT|TBSTYLE_TRANSPARENT|CCS_NODIVIDER);
   $self->{TB}->AddButtons(4,
    I_IMAGENONE, 0, TBSTATE_ENABLED, BTNS_SHOWTEXT|BTNS_AUTOSIZE, 0,
    ...
   I_IMAGENONE, 3, TBSTATE_ENABLED, BTNS_SHOWTEXT|BTNS_AUTOSIZE, 3,
  );
  ]]></WGXExec>
  </Band>
  ...
 </Rebar>

Since WGX has yet to support adding Toolbar buttons directly with it's API you must do so by embedding Win32::GUI code using WGXExec. A sketch of the Menu generation code looks a little like this: -

<WGXMenu>
<Button name='M0'>
 <Item text='Open...'
  onClick='sub{
   my $file = Win32::GUI::GetOpenFileName(
    ...
   );
   if (-f $file) {
    $currentFile = $file;
    loadfile();
   }
  }'
 />
 ...
 <Item seperator='1'/>
 ...
<Item text='Exit' onClick='sub { Exit($_[0]) }'/> </Button>
<Button name='M1'>
 ...
</Button>
<Button name='M2'>
 <Item text='View Source' onClick='sub {
  $self->{POD}->Hide;
  $self->{Source}->Show;
  $self->{View}->Select(1);
 }'/>
 ...
</Button>
<Button name='M3'>
 ...
</Button>
</WGXMenu>

It is really worth looking at the source code to get a real picture of what is happening. PodView is still in development so I won't guarantee it's bug free but it's certainly usable. I would like to add button icons at some point - it's just finding the time at the moment.

Best
Blair

Jez White wrote:

Hi Blair,

Nice screenshot of the PodViewer - is this a Win32::GUI application? If so, how have you done the menu/tool bar at the top?:)

Cheers,

jez.
----- Original Message ----- From: "Blair Sutton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <"mailto:perl-win32-gui-users"@lists.sourceforge.net>
Sent: Thursday, January 27, 2005 9:15 PM
Subject: [perl-win32-gui-users] Re: TabStrip Question


Hi Leonard,

Another solution is to use Win32::GUI::XMLBuilder (WGX). WGX will do automatic resizing of child widgets for you and also you get the chance to use WGXSplitter, this allows you to resize your TreeView and your TabStrip frames one the fly. A typical example of this format is used in my PodView example downloadable as part of my niPerl distribution. See http://www.numeninest.com/Perl/podview.php for a screenshot of PodView.

Good luck.
Blair

Hey Everyone, I've got a completely newbie question.

I've used Win32::GUI a few times in the past to create simple interfaces, however I am now looking to create an interface that is a bit more complex. What I would like to do is create a GUI that has a TreeView on the left hand side, and then on the right hand side have a Tab interface that supports 2-3 tabs. I would always like the TreeView showing, which is simple enough, however i'm not sure how to add in the Tab interface to the right hand side so that the TreeView is not part of the tabs. I hope i'm explaining this well enough.

Is this possible?  And if so, how would I go about doing this?



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
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