[Gambas-user] Buttons again not working

M. Cs. mohareve at ...626...
Wed Dec 9 18:21:46 CET 2009


What do you mean exactly by "communicate"? Can you provide the full source
> code in a project, we will better understand what you want to do.
>
> Beware that an object is locked during its _new() so it cannot receive
> events.
>
> Regards,
>
> --
> Benoît Minisini
>
>
>
I mean, the procedure Ops_Click() is simply never invoked. A window shows
up, with an image, a text and a button - "butty". I intend to to use this
button for closing the window. The first occurance of the subroutine
Messenger is in the _new() procedure, which is intended to set the initial
settings for the program. At the time when this happens, no other forms are
already created. The code is pretty long ( 7000 lines, the *GamCat* project
on sourceforge, but I'm sending you the first part of it, the _new()
procedure:

PUBLIC SUB _new() '############# Initial settings
######################################################################
DIM q1, q2, xenon, path, nfile AS String
DIM place, node, temptxt, querry, prime, liner, x, mounter, onefound AS
String
DIM tarto, gomb, nexus, tremor, mark, mounthits, secondary AS String[]
DIM i, knor, l, m AS Integer
DIM fstab, config AS File
a1 = NEW String[]
a2 = NEW String[]
a3 = NEW String[]
a4 = NEW Float[]
a5 = NEW String[]
valvolume = NEW String[]
DVDPanel.Value = FALSE
'At start the Virtual Compilation is empty and features are disabled
tippi.Add(tippiData.Text)
tippi.Add(tippiAudio.Text)
rating.Add("-")
ratingPic.Picture = Picture["unrated.png"]
year1.Value = Year(Now)
month1.Value = Month(Now)
day1.value = Day(Now)
year2.MinValue = year1.Value
mtype.Add("700 MB")
mtype.Add("4.4 GB")
mtype.Add("8.0 GB")
mediaImg.Picture = Picture["CD.png"]
Saver.compilatSi = 700
IF Exist(User.Home & "/.GamCat") = FALSE THEN
MKDIR User.Home & "/.GamCat"
'First run screen for the devices

mark = NEW String[]
config = OPEN User.Home & "/.GamCat/config.txt" FOR CREATE
CLOSE (config)
*Messenger(firstrun.Text, "cat1.png")*


config = OPEN User.Home & "/.GamCat/config.txt" FOR WRITE
fstab = OPEN "/etc/mtab" FOR INPUT
WHILE NOT Eof(fstab)
LINE INPUT #fstab, place
mounthits = Split(place, " ")
IF (InStr(mounthits[1], "/media/") > 0 AND InStr(mounthits[2], "vfat") = 0)
THEN

node = InputBox(dev1.Text & mounthits[0], dev2.Text, "")
PRINT #config, mounthits[0]
mark.Add(node)
ENDIF

WEND
CLOSE (fstab)
CLOSE (config)

IF mark.Count = 0 THEN
Message(Fatal.Text)
node = "rm -rf " & Chr$(34) & User.Home & "/.GamCat" & Chr$(34)
SHELL node WAIT
QUIT
ENDIF

IF mark.Count = 1 THEN
mark.Add("second")
ENDIF




'Database creation
DBconX.Type = "sqlite"
DBconX.Host = User.Home & "/.GamCat"
TRY DBconX.Open()

IF ERROR THEN
Message(SetupError.Text)
node = "rm -rf " & Chr$(34) & User.Home & "/.GamCat" & Chr$(34)
SHELL node WAIT
QUIT
ELSE
IF NOT DBconX.Databases.Exist("GamCat") THEN
DBconX.Databases.Add("GamCat")
WAIT 0.5 'apperently this is needed for an SQLite database
' Close the server connection
DBconX.Close()
ENDIF
ENDIF

DBconX.Name = "GamCat"
DBconX.Type = "sqlite"
DBconX.Host = User.Home & "/.GamCat"
TRY DBconX.Open()
prime = "CREATE TABLE zzz(content VARCHAR(30),size REAL,files
INTEGER,folders INTEGER,timing TEXT,media TEXT)"
DBconX.Exec(prime)
WAIT 0.1
prime = "CREATE TABLE infos(size REAL,files INTEGER,folders INTEGER,nn
TEXT,first TEXT,second TEXT,delay TEXT);"
DBconX.Exec(prime)
q1 = Chr$(34) & "0" & Chr$(34)
q2 = Chr$(34) & "1" & Chr$(34)
prime = "INSERT INTO infos VALUES(0,0,0" & "," & q2 & ",'" & mark[0] & "','"
& mark[1] & "','20');"
DBconX.Exec(prime)
prime = "CREATE TABLE ZIP(Name TEXT,Volume TEXT,Parent TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE TAR(Name TEXT,Volume TEXT,Parent TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE RAR(Name TEXT,Volume TEXT,Parent TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE ARJ(Name TEXT,Volume TEXT,Parent TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE ACE(Name TEXT,Volume TEXT,Parent TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE AVAILABLEMYDISKLIST(Volume VARCHAR(30),Rating
TEXT,Genre TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE LENTMYDISKROMLIST(Volume VARCHAR(30),Used TEXT,Rating
TEXT,Genre TEXT,Time TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE AVAILABLEMYDVDLIST(Volume VARCHAR(30),Rating
TEXT,Genre TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE LENTMYDISKDVDLIST(Volume VARCHAR(30),Used TEXT,Rating
TEXT,Genre TEXT,Time TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE LISTOFMYCUSTOMERS(Name TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE LISTOFMYALLGENRES(Name TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE TEMPORALBASKETOFELEMENTS(Name TEXT,Origin TEXT,Rating
TEXT,Genre TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE LISTOFBANNEDFILES(Name TEXT);"
DBconX.Exec(prime)
prime = "CREATE TABLE CHANGEDFILENAMECATALOG(Old Text(30),Volume
Text(30),Path Text(30),NEW Text(30));"
DBconX.Exec(prime)
prime = "CREATE TABLE VOLUMENOTESFORALL(Volume Text(30),Notes Text(300));"
DBconX.Exec(prime)
WAIT 0.5

DBconX.Close()

i = Message.Question(MessageImport.Text, MessageYes.Text, MessageNo.Text)
IF i = 1 THEN
Dialog.Path = User.Home
Dialog.Filter = ["*.zip", "Zip Archive"]
IF Dialog.OpenFile(TRUE) THEN RETURN
FOR EACH nfile IN Dialog.Paths
path = nfile
NEXT
nfile = "unzip -o " & Chr$(34) & path & Chr$(34) & " -d " & Chr$(34) &
User.Home & "/.GamCat/" & Chr$(34)
SHELL nfile WAIT
ELSE

ENDIF
ENDIF

szelekt = NEW Integer[]
dvdmount.Hide()
cdmount.Hide()
ejectCD.Hide()
ejectDVD.Hide()
eszkoz = NEW String[]
tarto = NEW String[]
gomb = NEW String[]
cim = NEW String[]
mark = NEW String[]
selIndex = NEW Integer[]
unselIndex = NEW Integer[]
fstab = OPEN User.Home & "/.GamCat/config.txt" FOR INPUT
WHILE NOT Eof(fstab)
LINE INPUT #fstab, liner
IF InStr(liner, "#delay") > 0 THEN
Frame33.Visible = FALSE
hideDelay.Visible = FALSE
ELSE
eszkoz.Add(liner)
gomb.Add(liner)
cim.Add(liner)
ENDIF
WEND
CLOSE (fstab)

DBconX.Name = "GamCat"
DBconX.Type = "sqlite"
DBconX.Host = User.Home & "/.GamCat"
TRY DBconX.Open()
querry = "SELECT first,second,delay FROM infos;"
tablak = DBconX.Exec(querry)
FOR EACH tablak
dvdmount.Text = tablak!"first"
cdmount.Text = tablak!"second"
Saver.delay = CInt(tablak!"delay")
NEXT
Slider1.Value = Saver.delay





DBconX.Close()

IF gomb.Count = 1 THEN
n1 = Mid$(gomb[0], 6)
dvdmount.Show()
ejectDVD.Show()
ENDIF

IF gomb.Count = 2 THEN
n1 = Mid$(gomb[0], 6)
dvdmount.Show()
n2 = Mid$(gomb[1], 6)
cdmount.Show()
'masodik = cim[1]
ejectDVD.Show()
ejectCD.Show()
ENDIF
eszkoz.Clear()
tarto.Clear()




elolap = TRUE
Xval = FALSE
arjCB.Value = TRUE
zipCB.Value = TRUE
rarCB.Value = TRUE
tarCB.Value = TRUE
aceCB.Value = TRUE
muubi.Enabled = TRUE
scArch.Enabled = TRUE
volumePB.Value = 0
archPB.Value = 0
catTree.Clear()
fView.Clear()
gV.Columns.Count = 5
gV.Columns[0].Width = 300
gV.Columns[1].Width = 125
gv.Columns[2].Width = 200
gv.Columns[3].Width = 80
gV.Rows.Count = 0

gV.Columns[0].Title = gVI.Text
gV.Columns[1].Title = gVII.Text
gV.Columns[2].Title = gVIII.Text
gV.Columns[3].Title = gVIV.Text
gV.Columns[4].Title = gVV.Text
list.Rows.Count = 0
list.Columns.Count = 1
list.Columns[0].Title = listI.Text
fileRB.Value = TRUE
anyRB.Value = TRUE
ejectCD.Value = TRUE
ejectDVD.Value = TRUE

'Virtual Compilation tab
ViCo.Columns.Count = 3
ViCo.Rows.Count = 0
ViCo.Header = TRUE
ViCo.Columns[0].Width = 200
ViCo.Columns[1].Width = 150
' ViCo.Columns[2].Width = 300
ViCo.Columns[0].Title = gVI.Text
ViCo.Columns[1].Title = ViP.Text
ViCo.Columns[2].Title = gVIII.Text
SizeBar.Value = 0

infoView.Columns.Count = 2
infoView.Rows.Count = 6
infoView.Columns[0].Width = 90
infoView[0, 0].Text = lfs.Text
infoView[1, 0].Text = lmf.Text
infoView[2, 0].Text = mkl.Text
infoView[3, 0].Text = mpl.Text
infoView[4, 0].Text = ehy.Text
infoView[5, 0].Text = addedOn.Text

driveView.Columns.Count = 2
driveView.Rows.Count = 5
driveView.Columns[0].Width = 150
driveView.Columns[1].Width = 80
driveView[0, 0].Text = las.Text
driveView[1, 0].Text = Label4.Text
driveView[2, 0].Text = Label5.Text
driveView[3, 0].Text = Label6.Text
driveView[4, 0].Text = Label7.Text
sourMedDrive.Index = 0
FMain.Center
Vdata()
'Populate the Catalog tree

Populate()
catTree.MoveFirst()
IF catTree.Current.Count > 0 THEN
ures = FALSE
ELSE
ures = TRUE
ENDIF

querry = "SELECT content FROM zzz;"
tablak = DBconX.Exec(querry)
FOR EACH tablak
nuvola += 1
NEXT
CDcount.Text = nuvola
catBox.Add(MessageALL.Text)
prime = "SELECT * FROM LISTOFMYALLGENRES;"
tablak = DBconX.Exec(prime)

FOR EACH tablak

x = Replace$(tablak!"Name", "_", " ")
x = Replace$(x, "$", ".")
x = Replace$(x, "€", "-")
catBox.Add(x)
NEXT
l = catBox.Find(MessageALL.Text)
catBox.Index = l
END



More information about the User mailing list