mglobal.module

来自「Gambas is a graphical development enviro」· MODULE 代码 · 共 84 行

MODULE
84
字号
' Gambas module filePUBLIC db AS NEW ConnectionPUBLIC rs AS ResultPUBLIC rs1 AS ResultPUBLIC btnok AS StringPUBLIC btnno AS String''''''''''''''''''''''''''''''''''''sub to connect to mysql server''''''''''''''''''''''''''''''''''''PUBLIC FUNCTION conn(host AS String, lgn AS String, pass AS String) AS Boolean  db.close  db.Type = "mysql"    db.Host = host  db.Login = lgn  db.Password = pass  db.Open  RETURN TRUECATCH  Message.error(Error.text)  RETURN FALSEEND''''''''''''''''''''''''''''''''''''''''''sub to fill the tableview w/ records''''''''''''''''''''''''''''''''''''''''''PUBLIC SUB fill_view(tbv AS tableview, qry AS String)DIM i AS Float  rs1 = db.exec(qry)  WITH rs1    tbv.rows.count=0    IF .count<>0 THEN      tbv.columns.count=.fields.count      tbv.rows.count=.count    END IF  END WITHEND''''''''''''''''''''''''''''''''''''''sub to check the keypress events''''''''''''''''''''''''''''''''''''''PUBLIC FUNCTION chk(txt AS textbox, code AS Integer, OPTIONAL tipe AS String) AS Integer  SELECT CASE code    CASE Key.Escape      IF txt.text<>"" THEN        txt.text=""      ELSE        RETURN 1      ENDIF        CASE ELSE      SELECT CASE tipe        CASE "num"          IF NOT (code >= Asc("0") AND code <= Asc("9") OR             code=key.up OR code=key.down OR code=key.left OR code=key.right OR             code=key.backspace OR code=key.tab OR code=key.enter OR code=key.return OR             code=key.home OR code=key.end OR code=key.delete OR code=key.up) THEN            RETURN 2          END IF                CASE "date"          IF NOT (code >= Asc("0") AND code <= Asc("9") OR code=Asc("/") OR             code=key.up OR code=key.down OR code=key.left OR code=key.right OR             code=key.backspace OR code=key.tab OR code=key.enter OR code=key.return OR             code=key.home OR code=key.end OR code=key.delete OR code=key.up) THEN            RETURN 2          END IF      END SELECT  END SELECTENDSUB dump()'             code=4099 OR code=4096 OR code=4100 OR code=4112 OR '             code=4113 OR code=4103 OR code=4102 OR code=4118 OR '             code=4119 OR code=4128 OR code=4133 OR code=4132 OR '             code=4134 OR code=4097 OR code=4131 OR code=4129 OR '             code=4181 OR code=4116 OR code=4114 OR code=4115 OR '             code=4117) THEN RETURN 2END

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?