Connecting the Forms to the Data-Layer (part 1)

Completing this series of Entries can not be complete until we connect the data-Layer with the Forms, and the is the goal of these next few entries. As methodical as my approch was with the Data-Layer, will be my approach to Forms. Now regardless, of what tool, if any, you use to develop your forms; Forms serve only Two Purposes. The first being, to present data, from the database, to the users, and Secondly to input all changes the user makes back into the Database. I will pick up where we left off, and build out our Galaxy/SolarSystem Example with the following Forms:

Galaxy Form:





Solar System Form:




And here is the Code that generates these forms.


Procedure.i Window_frmSolarSystem()
  If OpenWindow(#Window_frmSolarSystem,0,0,430,186,"Solar System",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible,WindowID(#Window_frmMain))
      TextGadget(#Gadget_frmSolarSystem_lbName,40,10,150,25,"Name: ",#PB_Text_Right)
      SetGadgetFont(#Gadget_frmSolarSystem_lbName,LoadFont(#Gadget_frmSolarSystem_lbName,"Rockwell",14))
      StringGadget(#Gadget_frmSolarSystem_txtName,195,10,195,25,"")
      TextGadget(#Gadget_frmSolarSystem_lbGRow,40,40,150,25,"Galaxy Row: ",#PB_Text_Right)
      SetGadgetFont(#Gadget_frmSolarSystem_lbGRow,LoadFont(#Gadget_frmSolarSystem_lbGRow,"Rockwell",14))
      StringGadget(#Gadget_frmSolarSystem_txtGrow,195,40,40,25,"")
      TextGadget(#Gadget_frmSolarSystem_lbGCol,25,70,165,25,"Galaxy Column: ",#PB_Text_Right)
      SetGadgetFont(#Gadget_frmSolarSystem_lbGCol,LoadFont(#Gadget_frmSolarSystem_lbGCol,"Rockwell",14))
      StringGadget(#Gadget_frmSolarSystem_txtGCol,195,70,40,25,"",#PB_String_Numeric)
      ButtonGadget(#Gadget_frmSolarSystem_btSave,150,125,105,30,"Save")
      ButtonGadget(#Gadget_frmSolarSystem_btCancel,270,125,105,30,"Cancel")
      HideWindow(#Window_frmSolarSystem,#False)
    ProcedureReturn WindowID(#Window_frmSolarSystem)
  EndIf
EndProcedure


Procedure.i Window_frmGalaxy()
  If OpenWindow(#Window_frmGalaxy,0,0,453,501,"Galaxy",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible,WindowID(#Window_frmMain))
      TextGadget(#Gadget_frmGalaxy_lbName,40,35,150,25,"Galaxy Name: ",#PB_Text_Right)
      SetGadgetFont(#Gadget_frmGalaxy_lbName,LoadFont(#Gadget_frmGalaxy_lbName,"Rockwell",14))
      StringGadget(#Gadget_frmGalaxy_txtName,195,35,195,25,"")
      TextGadget(#Gadget_frmGalaxy_lbSolarsystems,85,85,275,25,"Solar Systems",#PB_Text_Center)
      SetGadgetFont(#Gadget_frmGalaxy_lbSolarsystems,LoadFont(#Gadget_frmGalaxy_lbSolarsystems,"Rockwell",14))                      ListIconGadget(#Gadget_frmGalaxy_liSolarsystems,85,115,275,300,"ListIcon112",100,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
      ButtonImageGadget(#Gadget_frmGalaxy_btCreate,375,155,50,50,ImageID(#Image_frmGalaxy_btCreate))
      ButtonImageGadget(#Gadget_frmGalaxy_btModify,375,215,50,50,ImageID(#Image_frmGalaxy_btModify))
      ButtonImageGadget(#Gadget_frmGalaxy_btDelete,375,275,50,50,ImageID(#Image_frmGalaxy_btDelete))
      ButtonGadget(#Gadget_frmGalaxy_btSave,195,440,105,30,"Save")
      ButtonGadget(#Gadget_frmGalaxy_btCancel,315,440,105,30,"Cancel")
      HideWindow(#Window_frmGalaxy,#False)
    ProcedureReturn WindowID(#Window_frmGalaxy)
  EndIf
EndProcedure

Comments

Popular posts from this blog

How to build this without writing Code

Connecting the Forms to the Data-Layer (part 9)

Connecting the Forms to the Data-Layer (part 8)