PureBasic

Forums PureBasic
Nous sommes le Sam 24/Oct/2020 3:52

Heures au format UTC + 1 heure




Poster un nouveau sujet Répondre au sujet  [ 4 messages ] 
Auteur Message
 Sujet du message: Customizable table for pureBasic
MessagePosté: Mer 18/Mar/2020 9:54 
Hors ligne
Avatar de l’utilisateur

Inscription: Mer 29/Juin/2011 14:11
Messages: 1733
Localisation: Belgique
Dans ses temps troublé, on a le temps de coder. Voici un module table en version 1.1 beta 1

Image

Image

Image

Image

Comment l'installer

  • Installer git ICI
  • Faite un click droit sur une répertoire de votre choix et choisiser "Git Bash here"
  • Dans le terminal Git taper "git clone https://github.com/microdevweb/PB_TABLE"
  • Ouvrer le sous-répertoire "PB_TABLE" et exécuter "example1.pb "

Mise à jour de la version 1.1.b1
  • Faite un click droit sur le répertoire PB_TABLE et choisiser "Git Bash here"
  • taper la commande "git pull"
  • choisiser la dernière branche "git checkout version.1.1"

Image

Vers Github

Code de l'exemple

Code:
XIncludeFile "include/tb/tb.pbi"
UsePNGImageDecoder()
Enumeration
  #FORM
  #CONTAINER
  #FIC
  #ST_FN
  #ST_SN
  #ST_AGE
  #ST_SIZE
  #ST_WEIGHT
EndEnumeration

Structure person
  firstName.s
  surname.s
  age.l
  size.f
  weight.d
  icon.l
  info.s
EndStructure

Global NewList myPeople.person(),
               img_warning = CatchImage(#PB_Any,?war),
               img_phone = CatchImage(#PB_Any,?phone), 
               img_busnes = CatchImage(#PB_Any,?bus)


Procedure.s getFirstName(*this.person)
  With *this
    ProcedureReturn \firstName
  EndWith
EndProcedure

Procedure.s getSurName(*this.person)
  With *this
    ProcedureReturn \surname
  EndWith
EndProcedure

Procedure getAge(*this.person)
  With *this
    ProcedureReturn \age
  EndWith
EndProcedure

Procedure.f getSize(*this.person)
  With *this
    ProcedureReturn \size
  EndWith
EndProcedure

Procedure.d getWeight(*this.person)
  With *this
    ProcedureReturn \weight
  EndWith
EndProcedure

Procedure setName(*this.person,value.s)
  With *this
    \firstName = value
    SetGadgetText(#ST_FN,\firstName)
  EndWith
EndProcedure

Procedure setSurname(*this.person,value.s)
  With *this
    \surname = value
    SetGadgetText(#ST_SN,\surname)
  EndWith
EndProcedure

Procedure setAge(*this.person,value)
  With *this
    \age = value
    SetGadgetText(#ST_AGE,Str(value))
  EndWith
EndProcedure

Procedure setSize(*this.person,value.f)
  With *this
    \size = value
    SetGadgetText(#ST_SIZE,StrF(value))
  EndWith
EndProcedure

Procedure setWeight(*this.person,value.d)
  With *this
    \weight = value
    SetGadgetText(#ST_WEIGHT,StrD(value))
  EndWith
EndProcedure

Procedure getIcon(*this.person)
  With *this
    ProcedureReturn \icon
  EndWith
EndProcedure

Procedure.s getInfo(*this.person)
  With *this
    ProcedureReturn \info
  EndWith
EndProcedure

Procedure exit()
  End
EndProcedure

Procedure makeData(table.TB::table)
  With myPeople()
    AddElement(myPeople())
    \firstName = "Pierre"
    \surname = "Bielen"
    \age = 55
    \size = 175.10
    \weight = 80.623
    \icon = img_busnes
    \info = "New Customer"
    table\addLine(@myPeople())
    AddElement(myPeople())
    \firstName = "André"
    \surname = "Dupond"
    \age = 48
    \size = 165.25
    \weight = 70.428
    \icon = img_warning
    \info = "This customer has"+Chr(10)+"order out"
    table\addLine(@myPeople())
    AddElement(myPeople())
    \firstName = "Paul"
    \surname = "Godelaine"
    \age = 49
    \size = 170.388
    \weight = 90.758
    \icon = img_phone
    \info = "Call him"+Chr(10)+"next week"+Chr(10)+"On his office phone"
    table\addLine(@myPeople())
    AddElement(myPeople())
    \firstName = "Eric"
    \surname = "Bosly"
    \age = 50
    \size = 164.189
    \weight = 110.25
    table\addLine(@myPeople())
    For i = 1 To 100
      AddElement(myPeople())
      \firstName = "name "+Str(i)
      \surname = "surname"+Str(i)
      \age = Random(65,20)
      \size = 180.23
      \weight = 70.999
      table\addLine(@myPeople())
    Next
  EndWith
EndProcedure

Procedure fillFic(*this.person)
  With *this
    SetGadgetText(#ST_FN,\firstName)
    SetGadgetText(#ST_SN,\surname)
    SetGadgetText(#ST_AGE,Str(\age))
    SetGadgetText(#ST_SIZE,StrF(\size))
    SetGadgetText(#ST_WEIGHT,StrD(\weight))
  EndWith
EndProcedure

Procedure start()
  Protected table.TB::table,y = 10
  Protected *cs.TB::stringColumn,*ci.TB::integerColumn,*cf.TB::floatColumn,*cd.TB::doubleColumn,
            *cc.TB::imageColumn
  OpenWindow(#FORM,0,0,800,600,"Example version 1.0.b6",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
  ContainerGadget(#CONTAINER,10,10,400,580)
  table = TB::newTable(#CONTAINER)
  table\setTitle("List of customer")
  *cs = table\addColumn(TB::newStringColumn("Firstname",0.30,@getFirstName()))
  *cs\setEditable(@setName())
  *cs = table\addColumn(TB::newStringColumn("Surname",0.30,@getSurName()))
  *cs\setEditable(@setSurname())
  *ci = table\addColumn(TB::newIntegerColumn("Age",0.2,@getAge()))
  *ci\setEditable(@setAge())
  *cf = table\addColumn(TB::newFloatColumn("Size",0.2,@getSize()))
  *cf\setEditable(@setSize())
  *cd = table\addColumn(TB::newDoubleColumn("Weight",0.2,@getWeight()))
  *cd\setEditable(@setWeight())
  *cc = table\addColumn(TB::newImageColumn("Status",0.2,@getIcon()))
  *cc\setSize(0.6)
  *cc\enableTooltip(@getInfo())
  makeData(table)
  table\setSelectCallback(@fillFic())
  table\show()
  CloseGadgetList()
  ContainerGadget(#FIC,GadgetWidth(#CONTAINER)+20,10,WindowWidth(#FORM)- GadgetWidth(#CONTAINER) - 30,580)
  TextGadget(#PB_Any,10,y,GadgetWidth(#FIC) - 20,30,"Firstname")
  y + 30
  StringGadget(#ST_FN,10,y,GadgetWidth(#FIC) - 20,30,"")
  y + 40
  TextGadget(#PB_Any,10,y,GadgetWidth(#FIC) - 20,30,"Surname")
  y + 30
  StringGadget(#ST_SN,10,y,GadgetWidth(#FIC) - 20,30,"")
  y + 40
  TextGadget(#PB_Any,10,y,GadgetWidth(#FIC) - 20,30,"Age")
  y + 30
  StringGadget(#ST_AGE,10,y,GadgetWidth(#FIC) - 20,30,"")
  y + 40
  TextGadget(#PB_Any,10,y,GadgetWidth(#FIC) - 20,30,"Size")
  y + 30
  StringGadget(#ST_SIZE,10,y,GadgetWidth(#FIC) - 20,30,"")
  y + 40
  TextGadget(#PB_Any,10,y,GadgetWidth(#FIC) - 20,30,"Weight")
  y + 30
  StringGadget(#ST_WEIGHT,10,y,GadgetWidth(#FIC) - 20,30,"")
  CloseGadgetList()
  BindEvent(#PB_Event_CloseWindow,@exit(),#FORM)
EndProcedure

start()

Repeat :WaitWindowEvent():ForEver

DataSection
  war:
  IncludeBinary "images/warning.png"
  phone:
  IncludeBinary "images/phone.png"
  bus:
  IncludeBinary "images/busnes.png"
EndDataSection




La table peut se personnalisée
avec
Code:
TB::defaultColors\...
TB::defaultFont\...
TB::defaultSize\...

_________________
Windows 10 64 bits PB: 5.70 ; 5.72 LST
Work at Centre Spatial de Liège


Dernière édition par microdevweb le Sam 21/Mar/2020 0:53, édité 4 fois.

Haut
 Profil  
Répondre en citant le message  
 Sujet du message: Re: Customizable table for pureBasic
MessagePosté: Mer 18/Mar/2020 13:14 
Hors ligne

Inscription: Mer 04/Nov/2015 17:39
Messages: 1196
Cool ça merci :)

_________________
Processeur: Intel Core I7-4790 - 4 Cœurs - 8 Thread: 3.60 Ghz.
Ram: 32 GB.
Disque: C: SDD 250 GB, D: 3 TB.
Vidéo: NVIDIA GeForce GTX 960: 2 GB DDR5.
Écran: Asus VX248 24 Pouces: 1920 x 1080.
Système: Windows 7 64 Bits.

PureBasic: 5.60 x64 Bits.


Haut
 Profil  
Répondre en citant le message  
 Sujet du message: Re: Customizable table for pureBasic
MessagePosté: Jeu 19/Mar/2020 9:44 
Hors ligne
Avatar de l’utilisateur

Inscription: Mer 29/Juin/2011 14:11
Messages: 1733
Localisation: Belgique
new version 1.0.b2

_________________
Windows 10 64 bits PB: 5.70 ; 5.72 LST
Work at Centre Spatial de Liège


Haut
 Profil  
Répondre en citant le message  
 Sujet du message: Re: Customizable table for pureBasic
MessagePosté: Jeu 19/Mar/2020 13:42 
Hors ligne
Avatar de l’utilisateur

Inscription: Mer 29/Juin/2011 14:11
Messages: 1733
Localisation: Belgique
Version 1.0 beta 3 is out

_________________
Windows 10 64 bits PB: 5.70 ; 5.72 LST
Work at Centre Spatial de Liège


Haut
 Profil  
Répondre en citant le message  
Afficher les messages postés depuis:  Trier par  
Poster un nouveau sujet Répondre au sujet  [ 4 messages ] 

Heures au format UTC + 1 heure


Qui est en ligne

Utilisateurs parcourant ce forum: Bing [Bot] et 6 invités


Vous ne pouvez pas poster de nouveaux sujets
Vous ne pouvez pas répondre aux sujets
Vous ne pouvez pas éditer vos messages
Vous ne pouvez pas supprimer vos messages

Rechercher:
Aller à:  
cron

 


Powered by phpBB © 2008 phpBB Group | Traduction par: phpBB-fr.com
subSilver+ theme by Canver Software, sponsor Sanal Modifiye