Coder Social home page Coder Social logo

justwin32's Introduction

JustWin32

A stripped down version of GUIDeFATE for just using Win32::GUI in windows machines

Easy Install Steps

  1. install the latest Strawberry Perl
  2. download the .zip of this repository, extract it into your Documents directory

The Windows Way (recommended for starters)

  1. open Windows Explore, go to Documents/JustWin32-main
  2. double click "setup" (this will ensure the Win32::GUI module is installed)
  3. double click "calculator" (this will run the necessary Perl command)

The Commandline Way

  1. Open the Strawberry Perl CMD window (via Start > Programs > Strawberry Perl > Perl (commandline)
  2. "cd" to ./JustWin32-main
  3. type in "setup.bat", hit (this will ensure the Win32::GUI module is installed)
  4. type in "calculator.bat", hit (this runs the necessary Perl command)

Background Information

GUIDeFATE used to be notoriously difficult to install, trying to make many different backends which do make things difficult for individual projects that don't need this versatility, or when dependencies are difficult to find. Installation of dependencies (only Win32::GUI and Imager at present. Functionality is similar to GUIDeFATE. The Wiki there will give you an idea of how it works while I sort out simplified documentation for this.

image

#!/usr/bin/env perl 
#A test script that  generates a calculator style interface
#uses GUIDeFATE::JustWin32, which is bundled with GFWin32
#Dependencies Win32::GUI and Imager
#This file designed to be called by Executioner for backend testing

use strict;
use warnings;
use  GUIDeFATE::JustWin32;;

my $window=<<END;
+------------------------+
|T  Calculator           |
+M-----------------------+
|  [                  ]  |
|  {sqr}{pi }{ C }{AC }  |
|  { 1 }{ 2 }{ 3 }{ + }  |
|  { 4 }{ 5 }{ 6 }{ - }  |
|  { 7 }{ 8 }{ 9 }{ * }  |
|  { . }{ 0 }{ = }{ / }  |
|  made with GUIdeFATE   |
|  and happy things      |
+------------------------+

END

my $result=0;
my $acc="";
my $assist="v";
my $gui= GUIDeFATE::JustWin32->new($window,$assist);
my $frame=$gui->getFrame()||$gui;
$gui->MainLoop();

sub textctrl0 #called using Text Control with default text '                    '
  {
  $result=$frame->getValue("textctrl0");
   };

sub btn1 #called using button with label V 
  {
	  my $tmp=$frame->getValue("textctrl0");
      $result=sqrt($tmp);
      $frame->setValue("textctrl0", $result)
   };

sub btn2 #called using button with label pi 
  {
     $frame->setValue("textctrl0", 3.14159267)
   };

sub btn3 #called using button with label C 
  {
      $result=0;
      $frame->setValue("textctrl0", $result)
   };

sub btn4 #called using button with label AC 
  {
      $result=0;
      $frame->setValue("textctrl0", $result) 
   };

sub btn5 #called using button with label 1 
  {  
	 my $tmp=$frame->getValue("textctrl0");
	 if ($tmp eq "0"){ $frame->setValue("textctrl0", 1) }
     else {$frame->appendValue("textctrl0", 1) }
   };

sub btn6 #called using button with label 2 
  {
	 my $tmp=$frame->getValue("textctrl0");
	 if ($tmp eq "0"){ $frame->setValue("textctrl0", 2) }
     else {$frame->appendValue("textctrl0", 2) }
   };

sub btn7 #called using button with label 3 
  {
	  my $tmp=$frame->getValue("textctrl0");
	  if ($tmp eq "0"){ $frame->setValue("textctrl0", 3) }
	  else {$frame->appendValue("textctrl0", 3) }
   };

sub btn8 #called using button with label + 
  {
	  my $tmp=$frame->getValue("textctrl0");
	  $acc.=$tmp."+";print $acc."\n";
      $frame->setValue("textctrl0", 0)
   };

sub btn9 #called using button with label 4 
  {
	  my $tmp=$frame->getValue("textctrl0");
	  if ($tmp eq "0"){ $frame->setValue("textctrl0", 4) }
	  else {$frame->appendValue("textctrl0", 4) }
  
   };

sub btn10 #called using button with label 5 
  {
	  my $tmp=$frame->getValue("textctrl0");
	  if ($tmp eq "0"){ $frame->setValue("textctrl0", 5) }
	  else {$frame->appendValue("textctrl0", 5) }
   };

sub btn11 #called using button with label 6 
  {   
	  my $tmp=$frame->getValue("textctrl0");
	  if ($tmp eq "0"){ $frame->setValue("textctrl0", 6) }
	  else {$frame->appendValue("textctrl0", 6) }
   };

sub btn12 #called using button with label - 
  {
  	  my $tmp=$frame->getValue("textctrl0");
	  $acc.=$tmp."-";print $acc."\n";
      $frame->setValue("textctrl0", 0)
   };

sub btn13 #called using button with label 7 
  {
	  my $tmp=$frame->getValue("textctrl0");
	  if ($tmp eq "0"){ $frame->setValue("textctrl0", 7) }
	  else {$frame->appendValue("textctrl0", 7) }
   };

sub btn14 #called using button with label 8 
  {
	  my $tmp=$frame->getValue("textctrl0");
	  if ($tmp eq "0"){ $frame->setValue("textctrl0", 8) }
	  else {$frame->appendValue("textctrl0", 8) }
   };

sub btn15 #called using button with label 9 
  {
	  my $tmp=$frame->getValue("textctrl0");
	  if ($tmp eq "0"){ $frame->setValue("textctrl0", 9) }
	  else {$frame->appendValue("textctrl0", 9)}
  }

sub btn16 #called using button with label * 
  {   
	  my $tmp=$frame->getValue("textctrl0");
	  $acc.=$tmp."*";print $acc."\n";
	  print $acc."\n";
      $frame->setValue("textctrl0", 0)
   };

sub btn17 #called using button with label . 
  {
	  $frame->appendValue("textctrl0", ".")
   };

sub btn18 #called using button with label 0 
  {
	  $frame->appendValue("textctrl0", 0)
   };

sub btn19 #called using button with label = 
  {   
	  my $tmp=$frame->getValue("textctrl0");
	  $acc.=$tmp;print $acc."\n";
	  $result=eval($acc);
	  print $acc."=".$result."\n";
	  $frame->setValue("textctrl0", $result );
	  $acc="";
   };

sub btn20 #called using button with label / 
  {
	   my $tmp=$frame->getValue("textctrl0");
	   $acc.=$tmp."/";
	   $frame->setValue("textctrl0", 0)
   };

justwin32's People

Contributors

oodler577 avatar saiftynet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.