
sub Button_Property_Win {

   $CWin->Disable();
   $DWin->Disable();

   local ($w_left,$w_top) = $CWin->GetWindowRect();
  
   $Prop = new Win32::GUI::DialogBox(
       -left   => $w_left + $PROP_WIN_X_OFFSET,
       -top    => $w_top + $PROP_WIN_Y_OFFSET,
       -width  => 200,
       -height => 200,
       -title  => "Button Properties",
       -name   => "Prop",
   );

   $Prop->AddLabel(
       -left => 10,
       -top  => 10,
       -text => "Text:",
   );

   $Prop->AddTextfield(
       -left   => 50,
       -top    => 8,
       -width  => 100,
       -height => 20,
       -name   => "Text_TF",
   );

   $Prop->AddCheckbox(
       -left   => 10,
       -top    => 50,
       -text   => ($text = "Fixed Width"),
       -width  => length($text) * 7,
       -name   => "Fixed_CB",
   );

   $Prop->AddTextfield(
       -left   => 95,
       -top    => 52,
       -width  => 30,
       -height => 20,
       -name   => "Fixed_TF",
   );

   $Prop->AddLabel(
       -left => 130,
       -top  => 55,
       -text => "Pixels",
   );

   $Prop->AddButton(
       -left     => $Prop->Width / 2 - 65,
       -top      => $Prop->Height - 60,
       -width    => 60,
       -text     => "OK",
       -name     => "BP_OK",
       -default  => 1,
       -ok       => 1,
       -tabstop  => 1,
   );

   $Prop->AddButton(
       -left     => $Prop->Width / 2 + 5,
       -top      => $Prop->Height() - 60,
       -width    => 60,
       -text     => "Cancel",
       -name     => "BP_Cancel",
       -cancel   => 1,
       -tabstop  => 1,
   );

   if ($Prop->Fixed_CB->Checked()) {
      $Prop->Fixed_TF->Enable();
   }
   else {
      $Prop->Fixed_TF->Disable();
   }

   $Prop->Fixed_TF->Text("$FixVal");

   $Prop->Show();

   sub Prop_Terminate {
      &Prop_Win_Done;
   } 

   sub Prop_Win_Done {
     $Prop->Hide();
     $CWin->Enable();
     $CWin->SetForegroundWindow();
     $DWin->Enable();
     $DWin->SetForegroundWindow();
     $DWin->SetFocus();
   }

   sub Fixed_CB_Click {
      if ($Prop->Fixed_CB->Checked()) {
         $Prop->Fixed_TF->Enable();
      }
      else {
         $Prop->Fixed_TF->Disable();
      }
   }

   sub BP_OK_Click {
      &Prop_Win_Done;

      if ($Prop->Fixed_CB->Checked()) {
         $FixVal = $Prop->Fixed_TF->Text;
      }
      else {
         $FixVal = undef;
      }

      &New_Button($Prop->Text_TF->Text,$FixVal);
   }
       
   sub BP_Cancel_Click {
      &Prop_Win_Done;
      &New_Button(undef);
   }
}

1;
