Howto lock file in Files and Directories
by Benoit in gambas-user mailing list
DIM hFile AS File
TRY hFile = LOCK "~/lock"
IF ERROR THEN
PRINT "Already locked by something else!"
ELSE
PRINT "Got locked!"
UNLOCK hFile
ENDIFby Benoit in gambas-user mailing list
DIM hFile AS File
TRY hFile = LOCK "~/lock"
IF ERROR THEN
PRINT "Already locked by something else!"
ELSE
PRINT "Got locked!"
UNLOCK hFile
ENDIFME.Center
'or if calling from other form
frmTarget.CenterTaken from http://forum.stormweb.no/index.php/topic,441.msg1196.html#msg1196
This one will prevent SpinBox's _Change to action
PUBLIC SUB Form_Open()
OBJECT.LOCK(SpinBox1)
SpinBox1.Value = 50
OBJECT.UNLOCK(SpinBox1)
ENDDIM data AS STRING
data = InputBox("TEXT ON INPUTBOX", "THE TITLE", "DEFAULT VALUE")
PRINT dataDIM cSource AS Collection
DIM cDest AS NEW Collection
DIM vVal AS VARIANT
FOR EACH vVal IN cSource
cDest[cSource.Key] = vVal
NEXTHere is a small snippet to detect the press of arrow keys in the form keypress event.
PUBLIC CONST ARROW_LEFT AS INTEGER = 4114
PUBLIC CONST ARROW_RIGHT AS INTEGER = 4116
PUBLIC CONST ARROW_UP AS INTEGER = 4115
PUBLIC CONST ARROW_DOWN AS INTEGER = 4117
PUBLIC SUB Form_KeyPress()
SELECT CASE Key.Code
CASE ARROW_LEFT
PRINT "You pressed the left arrow key."
CASE ARROW_RIGHT
PRINT "You pressed the right arrow key."
CASE ARROW_UP
PRINT "You pressed the up arrow key."
CASE ARROW_DOWN
PRINT "You pressed the down arrow key."
END SELECT
END