Guidance
指路人
g.yi.org
software / rapidq / Examples / Date & Time / Carnet v2 / options.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'------------ OPTIONS
     CONST opfile="data\options.txt"
     DIM options AS QSTRINGLIST

     FUNCTION getoption(key AS STRING,default AS INTEGER) AS INTEGER
      DIM s AS STRING, thiskey AS STRING, thisarg AS STRING
      DIM i AS INTEGER
      FOR i=0 TO options.itemcount-1
       s=options.item(i)
       thiskey=FIELD$(s,"=",1)
       IF LCASE$(thiskey)=LCASE$(key) THEN
        thisarg=FIELD$(s,"=",2)
        getoption=VAL(thisarg)
        EXIT FUNCTION
       END IF
      NEXT
      getoption=default
     END FUNCTION

     FUNCTION getoptionstr(key AS STRING,default AS STRING) AS STRING
      DIM s AS STRING, thiskey AS STRING, thisarg AS STRING
      DIM i AS INTEGER, placeegal AS INTEGER
      FOR i=0 TO options.itemcount-1
       s=options.item(i)
       thiskey=FIELD$(s,"=",1)
       IF LCASE$(thiskey)=LCASE$(key) THEN
        placeegal=INSTR(s,"=")
        thisarg=MID$(s,placeegal+1,LEN(s)-placeegal)
        IF LEFT$(thisarg,1)=CHR$(34) THEN thisarg=MID$(thisarg,2,LEN(thisarg)-2)
        getoptionstr=thisarg
        EXIT FUNCTION
       END IF
      NEXT
      getoptionstr=default
     END FUNCTION

     CHDIR appdir
     IF FILEEXISTS(opfile) THEN options.loadfromfile(opfile)

'-- Global options
     DEFINT defaultformwidth=screen.width*getoption("defaultformwidth",0.875) '866
     DEFINT defaultformheight=screen.height*getoption("defaultformheight",0.83) '605
     DEFINT addphoneprefix=getoption("addphoneprefix",0)
     DEFSTR phoneprefix=getoptionstr("phoneprefix","")
     DEFSTR appfont=getoptionstr("appfontname","Tahoma")
     DEFINT appfontsize=getoption("appfontsize",9)
     IF screen.width<1000 THEN appfontsize--
     CREATE appQfont AS QFONT
      name=appfont
      size=appfontsize
     END CREATE
     CREATE appsmallfont AS QFONT
      name=appfont
      size=appfontsize-1
     END CREATE

'-- Special Use
     DEFSTR UsespecialKey=getoptionstr("UsespecialKey","")
     DEFSTR UsespecialPrefix=getoptionstr("UsespecialPrefix","")
     DEFSTR UsespecialSuffix=getoptionstr("UsespecialSuffix","")

'-- Week organizer options
     DEFINT showweekend=getoption("showweekend",0)
     DEFINT nbjours=IIF(showweekend=0,5,7)           'nb of days in week
     DEFINT firstdaydisplayed=IIF(showweekend=0,1,firstdayofweek) 'first day of week
     DEFINT nbheures=getoption("nbheures",12) 'nb of hours in day
     DEFINT heure1=getoption("heure1",7)      'first hour of the day
     DEFINT quartdheure=getoption("hoursubdiv",4) 'nb of subdivisions of an hour
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2024-10-8  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:44:09