home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / oini.zip / TESTINI.PRG < prev   
Text File  |  1993-05-30  |  2KB  |  59 lines

  1. // Class TIniFile for CA-Clipper        (c) Antonio Linares, 1993
  2.  
  3. // Object Oriented INI Files management
  4. // Use examples
  5.  
  6. //----------------------------------------------------------------------------//
  7.  
  8. function Main()
  9.  
  10.     local oIni := TIniFile():Use( "MyApp.ini" )
  11.     local n
  12.  
  13.     if ! File( "MyApp.ini" )
  14.        BuildIni( oIni )
  15.     endif
  16.  
  17.     Alert( oIni:ClassName() )
  18.  
  19.     SetColor( oIni:cGet( "main", "colors" ) )
  20.     CLS
  21.  
  22.     @ 0, 0 SAY PadC( oIni:cGet( "main", "title" ), MaxCol() + 1 ) ;
  23.       COLOR oIni:cGet( "colors", "title" )
  24.  
  25.     @ MaxRow(), 0 SAY PadC( oIni:cGet( "main", "message" ), MaxCol() + 1 ) ;
  26.       COLOR oIni:cGet( "colors", "message" )
  27.  
  28.     @ 10, 10 PROMPT oIni:cGet( "MainMenu", "Item1" )
  29.     @ 12, 10 PROMPT oIni:cGet( "MainMenu", "Item2" )
  30.     MENU TO n
  31.  
  32.     oIni:Use()
  33.  
  34. return
  35.  
  36. //----------------------------------------------------------------------------//
  37.  
  38. function BuildIni( oIni )
  39.  
  40.    oIni:Set( "main", "title",   "The title of my program" )
  41.    oIni:Set( "main", "colors",  "W+/B, W+/R,,,N/BG" )
  42.    oIni:Set( "main", "message", "Main message of my program" )
  43.  
  44.    oIni:Set( "users", "supervisor", "PASSWORD" )
  45.  
  46.    oIni:Set( "colors", "title",   "GR+/RB" )
  47.    oIni:Set( "colors", "message", "GR+/BG" )
  48.  
  49.    oIni:Set( "MainMenu", "Item1", "My Clients" )
  50.    oIni:Set( "MainMenu", "Item2", "My Accounts" )
  51.  
  52.    oIni:Set( "Clients", "Dbf", "Clients.dbf" )
  53.  
  54.    oIni:Save()
  55.  
  56. return
  57.  
  58. //----------------------------------------------------------------------------//
  59.