Guidance
指路人
g.yi.org
software / rapidq / Examples / Database / ZecBank / proc.inc

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
'Procedures Declarations
     DECLARE SUB Menu11_Click()
     DECLARE SUB Menu12_Click()
     DECLARE SUB Menu13_Click()
     DECLARE SUB Menu14_Click()
     DECLARE SUB Menu21_Click()
     DECLARE SUB Menu22_Click()
     DECLARE SUB Menu23_Click()
     DECLARE SUB Menu24_Click()
     DECLARE SUB Menu25_Click()
     DECLARE SUB Menu26_Click()
     DECLARE SUB Menu15_Click()
     DECLARE SUB Menu28_Click()
     DECLARE SUB ShowBlocs()
     DECLARE SUB AddBloc_OK_OnClick()
     DECLARE SUB AddBloc_Cancel_OnClick()
     DECLARE SUB Activemenu()
     DECLARE SUB AddBlocFromFile_Browser_OnClick()
     DECLARE SUB AddBlocFromFile_OK_OnClick()
     DECLARE SUB AddBlocFromFile_Cancel_OnClick()

     DIM r AS LONG

'procedures
     SUB Menu11_Click()
	'
	'Create a new empty bank
	'
      CreateBank
      List.Clear
      Stat.Clear
      ActiveMenu
      ShowBlocs
     END SUB

     SUB Menu12_Click()
	'
	'Open a bank
	'
      fopen.CAPTION="Open a Bank"
      fopen.Filter="Zecreator Bank Files|*.ZBK|All Files|*.*"
      IF fopen.EXECUTE=false THEN
       EXIT SUB
      END IF
      stat.clear
      stat.addpanels "Loading..."
      LoadBank fopen.Filename
      ActiveMenu
      ShowBlocs
     END SUB

     SUB Menu13_Click()
	'
	'Save a bank
	'
      fsave.CAPTION="save a bank"
      fsave.Filter="Zecreator Bank Files|*.ZBK|All files|*.*"
      IF fsave.EXECUTE=false THEN
       EXIT SUB
      END IF

      SaveBank fsave.Filename
     END SUB

     SUB Menu14_Click()
	'
	'Exit to Windows
	'
      END
     END SUB


     SUB Menu15_Click()
	'
	'Save and Compress a bank
	'
      fsave.CAPTION="Compress a bank"
      fsave.Filter="Zecreator Bank Files|*.ZBK|All files|*.*"
      IF fsave.EXECUTE=false THEN
       EXIT SUB
      END IF

      CompressBank fsave.Filename
     END SUB

     SUB Menu21_Click()
	'
	'Open "Add Bloc" Form
	'
      AddBloc.CAPTION="Add bloc"
      AddBloc_NameText.Text=""
      AddBloc_NameText.enabled=True
      AddBloc_ValueLabel.Visible=true
      AddBloc_ValueText.Visible=true
      AddBloc_ValueText.Text=""
      AddBloc_Index.CAPTION="-1"
      AddBloc.Repaint
      AddBloc.SHOWMODAL
     END SUB

     SUB Menu22_Click()
	'
	'Open "Add Bloc from file" form
	'
      AddBlocFromFile.CAPTION="Add Bloc from file"
      AddBlocFromFile_NameText.Text=""
      AddBlocFromFile_NameText.enabled=True
      AddBlocFromFile_ValueText.Text=""
      AddBlocFromFile_Index.CAPTION="-1"
      AddBlocFromFile.Repaint
      AddBlocFromFile.SHOWMODAL
     END SUB


     SUB Menu23_Click()
	'
	'Open "Modify Bloc" form
	'
      IF list.itemindex=-1 THEN
       MESSAGEDLG "You must to select a bloc in the list.",mtwarning,0,0
       EXIT SUB
      END IF
      AddBloc.CAPTION="Modify Bloc form"
      AddBloc_NameText.Text=list.item(list.itemindex)
      AddBloc_NameText.enabled=false
      AddBloc_ValueText.Text=GetDataValue(list.item(list.itemindex))
      AddBloc_Index.CAPTION=STR$(list.itemindex)
      AddBloc.Repaint
      AddBloc.SHOWMODAL
     END SUB

     SUB Menu24_Click()
	'
	'Open "Modify Bloc from file" form
	'
      IF list.itemindex=-1 THEN
       MESSAGEDLG "You must to select a bloc in the list.",mtwarning,0,0
       EXIT SUB
      END IF

      AddBlocFromFile.CAPTION="Modify Bloc from file"
      AddBlocFromFile_NameText.Text=list.item(list.itemindex)
      AddBlocFromFile_NameText.enabled=false
      AddBlocFromFile_ValueText.Text=""
      AddBlocFromFile_Index.CAPTION=STR$(list.itemindex)
      AddBlocFromFile.Repaint
      AddBlocFromFile.SHOWMODAL
     END SUB

     SUB Menu25_Click()
	'
	'Open "Rename bloc" form
	'
      IF list.itemindex=-1 THEN
       MESSAGEDLG "You must to select a bloc in the list.",mtwarning,0,0
       EXIT SUB
      END IF

      AddBloc.CAPTION="Rename bloc"
      AddBloc_NameText.Text=list.item(list.itemindex)
      AddBloc_NameText.enabled=true
      AddBloc_ValueLabel.Visible=false
      AddBloc_ValueText.Visible=false
      AddBloc_Index.CAPTION=STR$(list.item(list.itemindex))
      AddBloc.Repaint
      AddBloc.SHOWMODAL
     END SUB

     SUB Menu26_Click()
	'
	'Delete a bloc
	'
      IF list.itemindex=-1 THEN
       MESSAGEDLG "You must to select a bloc in the list.",mtwarning,0,0
       EXIT SUB
      END IF

      IF MESSAGEDLG("Delete this bloc? Are you sure?", mtCustom, mbYes OR mbNo, 0) = mrNo THEN
	    'Keep
       EXIT SUB
      END IF

      DeleteData List.item(list.itemindex)
      DOEVENTS
      ShowBlocs
     END SUB

     SUB Menu28_Click()
	'
	'Extract a bloc in a file
	'
      IF list.itemindex=-1 THEN
       MESSAGEDLG "You must to select a bloc in the list.",mtwarning,0,0
       EXIT SUB
      END IF

      fsave.CAPTION="Extract bloc in a file"
      fsave.Filter="All files|*.*"
      IF fsave.EXECUTE=false THEN
       EXIT SUB
      END IF

      ExtractDataToFile list.item(list.itemindex),fsave.Filename
     END SUB

     SUB ShowBlocs()
	'
	'Show blocs in the list
	'
      list.clear
      FOR r=1 TO DatasCount
       list.AddItems GetDataName(r)
      NEXT

      Stat.clear
      Stat.AddPanels STR$(DatasCount) & " bloc(s) found"
     END SUB

     SUB AddBloc_OK_OnClick()
	'
	' Add/Modify bloc (Button Action)
	'
      IF AddBloc_NameText.Text="" THEN
       MESSAGEDLG "You must to enter a name of bloc.",mtWarning,0,0
       EXIT SUB
      END IF

      IF AddBloc_ValueText.Text="" AND AddBloc_ValueText.visible=true THEN
       MESSAGEDLG "You must to enter the datas of bloc.",mtWarning,0,0
       EXIT SUB
      END IF

      IF AddBloc_Index.CAPTION="-1"  AND AddBloc_ValueText.visible=true THEN
       AddData AddBloc_NameText.Text,AddBloc_ValueText.Text
      END IF

      IF AddBloc_Index.CAPTION<>"-1"  AND AddBloc_ValueText.visible=true THEN
       ReplaceData AddBloc_NameText.Text,AddBloc_ValueText.Text
      END IF

      IF AddBloc_Index.CAPTION<>"-1"  AND AddBloc_ValueText.visible=false THEN
       RenameData List.item(List.Itemindex),AddBloc_NameText.Text
      END IF

      AddBloc.CLOSE
      ShowBlocs
     END SUB

     SUB AddBloc_Cancel_OnClick()
	'
	' Cancel Add/Modify bloc (Button Action)
	'
      AddBloc.CLOSE
     END SUB

     SUB ActiveMenu()
	'
	'Activate the disabled items menus
	'
      Menu2.Enabled=true
      Menu13.Enabled=true
      Menu15.Enabled=true
     END SUB

     SUB AddBlocFromFile_Browser_OnClick()
	'
	' Select a file to add/modify a bloc (Button Action)
	'
      fopen.CAPTION="Select a file"
      fopen.filter="All files|*.*"

      IF fopen.EXECUTE=false THEN
       EXIT SUB
      END IF

      AddBlocFromFile_ValueText.text=fopen.filename
     END SUB

     SUB AddBlocFromFile_Cancel_OnClick()
	'
	' Cancel add/modify bloc from file (button action)
	'
      AddBlocFromFile.CLOSE
     END SUB

     SUB AddBlocFromFile_OK_OnClick()
	'
	' Add/modifiy bloc from file (button action)
	'
      IF AddBlocFromFile_NameText.Text="" THEN
       MESSAGEDLG "You must to enter a name of bloc.",mtWarning,0,0
       EXIT SUB
      END IF

      IF AddBlocFromFile_ValueText.Text="" THEN
       MESSAGEDLG "You must to select a file to this bloc.",mtWarning,0,0
       EXIT SUB
      END IF

      IF AddBlocFromFile_Index.CAPTION="-1" THEN
       AddDataFromFile AddBlocFromFile_NameText.Text,AddBlocFromFile_ValueText.Text
      END IF

      IF AddBlocFromFile_Index.CAPTION<>"-1" THEN
       ReplaceDataFromFile AddBlocFromFile_NameText.Text,AddBlocFromFile_ValueText.Text
      END IF

      AddBlocFromFile.CLOSE
      ShowBlocs
     END SUB

掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2021-4-16  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-06-11 13:33:46