It is currently Fri Nov 27, 2020 11:40 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: PureWindow
PostPosted: Tue Mar 31, 2020 9:05 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jun 13, 2014 9:38 am
Posts: 170
Location: Belgique
version beta 1

Make dialog use easier

Hello Guys,

A module for make dialog easier

How install it

  • Install git HERE
  • make a right click on a directory and choice "Git Bash here"
  • In the Git terminal paste this command "git clone https://github.com/microdevweb/PureWindow"
  • Open the subdirectory PureWindow" and run
    "exemple1.pb "
    "exemple2.pb "
    "exemple3.pb "
    "exemple4.pb "

Image

Code:
; --------------------------------------------------------------
; PURE_WINDOW
; version 1.0
; EXAMPLE 1
; a simple vertical box
; --------------------------------------------------------------
XIncludeFile "include/pw/pw.pbi"
Define flags = #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget
Global.PW::button bt1,bt2,bt3,bt4
Global mainForm.PW::Window = PW::newWindow(0,0,800,600,"Exemple 1",flags)
mainForm\setMinHeight(200)
mainForm\setMinWidth(200)
Global mainLayout.PW::VBox = mainForm\setLayout(PW::newVBox())
Global NewList text.s()




Procedure evButton(*bt.PW::button)
  ChangeCurrentElement(text(),*bt\getData())
  Debug text()
EndProcedure

bt1 = mainLayout\addChild(PW::newButton("Button 1"))
AddElement(text()):text()="I'm the button 1"
bt1\setData(@text())
bt1\bind(@evButton())
bt2 = mainLayout\addChild(PW::newButton("Button 2"))
AddElement(text()):text()="I'm the button 2"
bt2\setData(@text())
bt2\bind(@evButton())
bt3 = mainLayout\addChild(PW::newButton("Button 3"))
AddElement(text()):text()="I'm the button 3"
bt3\setData(@text())
bt3\bind(@evButton())
bt4 = mainLayout\addChild(PW::newButton("Button 4"))
AddElement(text()):text()="I'm the button 4"
bt4\setData(@text())
bt4\bind(@evButton())


PW::Application\run(mainForm)


Image

Code:
; --------------------------------------------------------------
; PURE_WINDOW
; version 1.0
; EXAMPLE 2
; a simple horizontal box
; --------------------------------------------------------------
XIncludeFile "include/pw/pw.pbi"
Define flags = #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget
Global.PW::button bt1,bt2,bt3,bt4
Global mainForm.PW::Window = PW::newWindow(0,0,800,600,"Exemple 2",flags)
mainForm\setMinHeight(200)
mainForm\setMinWidth(200)
Global mainLayout.PW::HBox = mainForm\setLayout(PW::newHBox())
Global NewList text.s()




Procedure evButton(*bt.PW::button)
  ChangeCurrentElement(text(),*bt\getData())
  Debug text()
EndProcedure

bt1 = mainLayout\addChild(PW::newButton("Button 1"))
AddElement(text()):text()="I'm the button 1"
bt1\setData(@text())
bt1\bind(@evButton())
bt2 = mainLayout\addChild(PW::newButton("Button 2"))
AddElement(text()):text()="I'm the button 2"
bt2\setData(@text())
bt2\bind(@evButton())
bt3 = mainLayout\addChild(PW::newButton("Button 3"))
AddElement(text()):text()="I'm the button 3"
bt3\setData(@text())
bt3\bind(@evButton())
bt4 = mainLayout\addChild(PW::newButton("Button 4"))
AddElement(text()):text()="I'm the button 4"
bt4\setData(@text())
bt4\bind(@evButton())


PW::Application\run(mainForm)


Image

Code:
; --------------------------------------------------------------
; PURE_WINDOW
; version 1.0
; EXAMPLE 3
; a fic customer
; --------------------------------------------------------------
XIncludeFile "include/pw/pw.pbi"
Define flags = #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget
Global.PW::button btValide,btCancel
Global.PW::HBox btLayout
Global.PW::VBox fielLayout,mainLayout
Global.PW::stringGadget stFName,stSName,stAddress
Global mainForm.PW::Window = PW::newWindow(0,0,320,20,"Exemple 3",flags)
LoadFont(0,"Arial",11,#PB_Font_HighQuality)

Procedure init()
  SetActiveGadget(stFName\getId())
EndProcedure

SetGadgetFont(#PB_Default,FontID(0))
mainLayout = mainForm\setLayout(PW::newVBox())
mainLayout\setExpand(1) ; expand field layout
fielLayout = mainLayout\addChild(PW::newVBox())
btLayout = mainLayout\addChild(PW::newHBox())
btLayout\setExpand(PW::#EXPAND_NO)
btLayout\setAlign(PW::#ALIGN_RIGHT)
stFName = fielLayout\addChild(PW::newStringGadget())
stFName\setHeight(30)
stFName\setLabel("First name")
stSName = fielLayout\addChild(PW::newStringGadget())
stSName\setHeight(30)
stSName\setLabel("Last name")

stAddress = fielLayout\addChild(PW::newStringGadget())
stAddress\setHeight(30)
stAddress\setLabel("Address")
btValide = btLayout\addChild(PW::newButton("Validate"))
btValide\setWidth(90)
btValide\setHeight(25)
btCancel = btLayout\addChild(PW::newButton("Cancel"))
btCancel\setWidth(90)
btCancel\setHeight(25)

PW::Application\setInitiation(@init())
PW::Application\run(mainForm)


Image

Code:
; --------------------------------------------------------------
; PURE_WINDOW
; version 1.0
; EXAMPLE 4
; a fic customer
; --------------------------------------------------------------
XIncludeFile "include/pw/pw.pbi"
Define flags = #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget
Global Dim bt.PW::button(12)
Global.PW::GridBox grid
Global mainForm.PW::Window = PW::newWindow(0,0,320,20,"Exemple 4",flags)
grid = mainForm\setLayout(PW::newGridBox(6))
For i = 0 To 11
  bt(i) = grid\addChild(PW::newButton("Button "+Str(i+1)))
  If i = 2
    grid\spanColums(bt(i),3)
  EndIf
  If i = 4
    grid\spanRows(bt(i),2)
  EndIf
Next
PW::Application\run(mainForm)

_________________
Use Pb 5.72 (beta 1) lst and Windows 10

my mother-language isn't english, in advance excuse my mistakes.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye