Re: [Gambas-user] make Label background from Database field

2009-10-19 Thread Kad Mann
On Mon, 2009-10-19 at 11:46 +0200, Doriano Blengino wrote: > Kad Mann ha scritto: > > No, you didn't insult anyone, and I sincerely apologise. I was having > > great difficulty following your English... > > > > > Is my english so bad? If you have difficulties to read it, think at the > difficul

Re: [Gambas-user] make Label background from Database field

2009-10-19 Thread Doriano Blengino
Kad Mann ha scritto: > No, you didn't insult anyone, and I sincerely apologise. I was having > great difficulty following your English... > > Is my english so bad? If you have difficulties to read it, think at the difficulties I have to write it... :-) Feel free to correct me, my own language i

Re: [Gambas-user] make Label background from Database field

2009-10-19 Thread Kad Mann
On Mon, 2009-10-19 at 10:34 +0200, Doriano Blengino wrote: > Kad Mann ha scritto: > I did'nt insult anyone in this list - never. Even taking my words the > worst possible way, at the point where I expressed a judgment on your > ideas (just *some* of your ideas), I did not judged you - this is wh

Re: [Gambas-user] make Label background from Database field

2009-10-19 Thread Doriano Blengino
Kad Mann ha scritto: > On Sun, 2009-10-18 at 14:00 +0200, Doriano Blengino wrote: > >> Kad Mann ha scritto: >> >>> On Sun, 2009-10-18 at 10:47 +0200, Doriano Blengino wrote: >>> >>> Kad Mann ha scritto: > On Sun, 2009-10-18 at 09:08 +0200, Doriano

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Werner
Vassilis K wrote: > After a more accurate control I discovered that the last record was not > included with red color. But when I put the LOOP up to rsThesi.Count it shows > up the same old error. > so I put just after the LOOP the line : > change_bgcolor("Label" & CInt(rsThesi!thesi)) > AND eve

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Vassilis K
After a more accurate control I discovered that the last record was not included with red color. But when I put the LOOP up to rsThesi.Count it shows up the same old error. so I put just after the LOOP the line : change_bgcolor("Label" & CInt(rsThesi!thesi)) AND everything is OK at last !! Here'

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Kad Mann
On Sun, 2009-10-18 at 14:00 +0200, Doriano Blengino wrote: > Kad Mann ha scritto: > > On Sun, 2009-10-18 at 10:47 +0200, Doriano Blengino wrote: > > > >> Kad Mann ha scritto: > >> > >>> On Sun, 2009-10-18 at 09:08 +0200, Doriano Blengino wrote: > >>> > >>> > Kad Mann ha scrit

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Doriano Blengino
Vassilis K ha scritto: > After the function of change_bgcolor that existed and Benoit reminded us, the > code is becoming more sophisticated: > > PUBLIC SUB Form_Open() > DIM rsThesi AS Result > DIM iTemp AS Integer > DIM sTemp AS String >MODMain.Connect() >rsThesi = MODMain.$Con.ex

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Vassilis K
After the function of change_bgcolor that existed and Benoit reminded us, the code is becoming more sophisticated: PUBLIC SUB Form_Open() DIM rsThesi AS Result DIM iTemp AS Integer DIM sTemp AS String MODMain.Connect() rsThesi = MODMain.$Con.exec("select * from egrafes where elenchos

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Doriano Blengino
Benoît Minisini ha scritto: >> I get error: >> "Result is not available" >> at line: >> "change_bgcolor("Label" & rsThesi!thesi)" >> >> of the code: >> >> PUBLIC SUB Form_Open() >> DIM i AS Integer >> DIM rsThesi AS Result >> MODMain.Connect() >> rsThesi = MODMain.$Con.exec("select * fr

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Benoît Minisini
> I get error: > "Result is not available" > at line: > "change_bgcolor("Label" & rsThesi!thesi)" > > of the code: > > PUBLIC SUB Form_Open() > DIM i AS Integer > DIM rsThesi AS Result > MODMain.Connect() > rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax = > 0")

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Doriano Blengino
Doriano Blengino ha scritto: > Dimitris Anogiatis ha scritto: > >> Vassili, >> >> Glad to hear that it's working for you :) >> >> > I join - congratulations! > > The only pity is to have such an awful case statement, when 5 or 6 lines > of code would do the same job. That SELECT it is n

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Doriano Blengino
Dimitris Anogiatis ha scritto: > Vassili, > > Glad to hear that it's working for you :) > I join - congratulations! The only pity is to have such an awful case statement, when 5 or 6 lines of code would do the same job. That SELECT it is not much faster, because it compares case by case until

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Dimitris Anogiatis
Vassili, Glad to hear that it's working for you :) Keep up the good work :) Regards, Dimitris On Sun, Oct 18, 2009 at 7:22 AM, Vassilis K wrote: > It is Solved !! > > > It works fine with: rsThesi.Count - 1 > > DO WHILE rsThesi.Index < rsThesi.Count - 1 > change_bgcolor(CInt(rsThe

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Vassilis K
It is Solved !! It works fine with: rsThesi.Count - 1 DO WHILE rsThesi.Index < rsThesi.Count - 1 change_bgcolor(CInt(rsThesi!thesi)) rsThesi.MoveNext() LOOP Thank you Dimitri and Doriano -- Come build wi

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Vassilis K
Dimitri it worked !! I put the code that you suggested and it works only when I put a number smaller than rsThesi.Count . For example when I put 10 it shows 10 Labels coloured ! I ' m writing down the code that worked: PUBLIC SUB Form_Open() DIM rsThesi AS Result DIM iTemp AS Integer DIM

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Dimitris Anogiatis
Vassili, Going back and forth through the whole thread I can also see that change_bgcolor is not as efficient as it could be simply because it's doing a loop looking through all the controls trying to match the desired control's name. for change_bgcolor I would suggest this Public SUB change_b

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Doriano Blengino
Kad Mann ha scritto: > On Sun, 2009-10-18 at 10:47 +0200, Doriano Blengino wrote: > >> Kad Mann ha scritto: >> >>> On Sun, 2009-10-18 at 09:08 +0200, Doriano Blengino wrote: >>> >>> Kad Mann ha scritto: > On Sat, 2009-10-17 at 22:46 +0300, Vassilis

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Kad Mann
On Sun, 2009-10-18 at 10:47 +0200, Doriano Blengino wrote: > Kad Mann ha scritto: > > On Sun, 2009-10-18 at 09:08 +0200, Doriano Blengino wrote: > > > >> Kad Mann ha scritto: > >> > >>> On Sat, 2009-10-17 at 22:46 +0300, Vassilis K wrote: > >>> > >>> > >>> > Dimitri I don't u

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Doriano Blengino
Kad Mann ha scritto: > On Sun, 2009-10-18 at 09:08 +0200, Doriano Blengino wrote: > >> Kad Mann ha scritto: >> >>> On Sat, 2009-10-17 at 22:46 +0300, Vassilis K wrote: >>> >>> >>> Dimitri I don't understand >>> Why don't you take a look at the database

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Vassilis K
Dear Doriano, I have tested both codes with sTemp = CStr(rsThesi!thesi) 'As a string variable AND then with iTemp = rsThesi!thesi 'As Integer I get the results on the console but the code now stops at: sTemp = CStr(rsThesi!thesi) OR at iTemp = rsThesi!thesi with message "Result is not

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Kad Mann
On Sun, 2009-10-18 at 09:08 +0200, Doriano Blengino wrote: > Kad Mann ha scritto: > > On Sat, 2009-10-17 at 22:46 +0300, Vassilis K wrote: > > > > > >> Dimitri I don't understand > >> > > > > Why don't you take a look at the database example in Gambas? > > > > After creating the test table,

Re: [Gambas-user] make Label background from Database field

2009-10-18 Thread Doriano Blengino
Kad Mann ha scritto: > On Sat, 2009-10-17 at 22:46 +0300, Vassilis K wrote: > > >> Dimitri I don't understand >> > > Why don't you take a look at the database example in Gambas? > > After creating the test table, if you type in an SQL command and click > the run button, you will see a gridv

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Dimitris Anogiatis
Vassili, it should look something like this PUBLIC SUB Form_Open() DIM i AS Integer DIM rsThesi AS Result 'connect to the database MODMain.Connect() 'Execute the SQL QueryI hope this helps. rsThesi = MODMain.$Con.EXEC("select * from egrafes where elenchosAnax = 0 AND thesi <> 0

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Kad Mann
On Sat, 2009-10-17 at 22:46 +0300, Vassilis K wrote: > Dimitri I don't understand Why don't you take a look at the database example in Gambas? After creating the test table, if you type in an SQL command and click the run button, you will see a gridview with a myriad colours that can be changed

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Vassilis K
Dimitri I don't understand where to place IF rsThesi.Index < rsThesi.Count THEN rsThesi.MoveNext() ENDIF If I use it for the loop of all the rows it only stops at row 2 and it shows Label12 (for example) red It also passes row 1 !!! I don't know if something like GOTO (the beginning of

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Doriano Blengino
Vassilis K ha scritto: > And of cource on: > > PRINT rsThesi!thesi > PRINT "Label" & rsThesi!thesi > > I get : > 2 > Label2 > 12 > Label12 > 57 > Label57 > 47 > Label47 > 33 > Label33 > 56 > Label56 > 44 > Label44 > 11 > Label11 > 78 > Label78 > 3 > Label3 > > etc. > > at Console window as describe

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Dimitris Anogiatis
Vassili, We're close... try IF rsThesi.Index < rsThesi.Count THEN rsThesi.MoveNext() ENDIF I hope this takes you a bit further in your project Keep up the good work Regards Dimitris On Sat, Oct 17, 2009 at 12:55 PM, Vassilis K wrote: > And of cource on: > > PRINT rsThesi!thesi > PRINT "

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Vassilis K
And of cource on: PRINT rsThesi!thesi PRINT "Label" & rsThesi!thesi I get : 2 Label2 12 Label12 57 Label57 47 Label47 33 Label33 56 Label56 44 Label44 11 Label11 78 Label78 3 Label3 etc. at Console window as described in my previous email and the code stops at PRINT rsThesi!thesi with resul

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Vassilis K
I tested : PRINT CStr(rsThesi!thesi) PRINT CStr(rsThesi.Index) Instead of change_bgcolor("Label" & rsThesi!thesi)" and I got everything working fine I got 42 couples of numbers as it should be: 38 0 15 1 47 2 74 3 96 4 etc... up to 42 row !! the first number was the correct rsThesi!thesi

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Dimitris Anogiatis
Vassili, Instead of change_bgcolor("Label" & rsThesi!thesi)" do PRINT CStr(rsThesi!thesi) PRINT CStr(rsThesi.Index) to see where it stops make sure it actually prints the same results. Keep in mind that the field name has to be EXACTLY the same as the one you use in mysql. worst comes to the w

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Doriano Blengino
Vassilis K ha scritto: > I have changed the Select of rsThesi to find only the records that thesi <> 0 > as following: > rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax = 0 > AND thesi <> 0 ") > Now it only counts 42 rows out of 70. > > But the error is the same as described

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Doriano Blengino
Dimitris Anogiatis ha scritto: > Vassili, > > Make sure there is data in the rsThesi!thesi field. > > Open a terminal, and login to mysql and do the Select statement from there > and see if all the records have data on the thesi field. > > if not then you have to do something like this > > if isNu

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Vassilis K
I have changed the Select of rsThesi to find only the records that thesi <> 0 as following: rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax = 0 AND thesi <> 0 ") Now it only counts 42 rows out of 70. But the error is the same as described in my previous email: "Result is no

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Dimitris Anogiatis
Vassili, Make sure there is data in the rsThesi!thesi field. Open a terminal, and login to mysql and do the Select statement from there and see if all the records have data on the thesi field. if not then you have to do something like this if isNull(rsThesi!thesi) = false then change_bgcolor("

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Vassilis K
I get error: "Result is not available" at line: "change_bgcolor("Label" & rsThesi!thesi)" of the code: PUBLIC SUB Form_Open() DIM i AS Integer DIM rsThesi AS Result MODMain.Connect() rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax = 0") rsThesi.MoveFirst

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Doriano Blengino
Vassilis A. Kanatas ha scritto: > Thank you Doriano, > > I tested the code that you proposed and got the following error: > > "Type mismatch: wanted Label, got PictureBox instead" > > at line: > For each alabel in Form1.Children (inside SUB change_bgcolor(...)) > > I have put all 100 Labels on Form

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Vassilis A. Kanatas
Thank you Doriano, I tested the code that you proposed and got the following error: "Type mismatch: wanted Label, got PictureBox instead" at line: For each alabel in Form1.Children (inside SUB change_bgcolor(...)) I have put all 100 Labels on Form1 above from the picture that I placed on the Fo

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Doriano Blengino
Vassilis K ha scritto: > Dimitri > > I changed it to your proposed option and I get : > "Result is not available" > error at line: > SELECT CASE rsThesi!thesi > > I do not know why it doesn't read the Result from database!!! > > You are right about the grid option. It looks more logical for 100 L

Re: [Gambas-user] make Label background from Database field

2009-10-17 Thread Vassilis K
Dimitri I changed it to your proposed option and I get : "Result is not available" error at line: SELECT CASE rsThesi!thesi I do not know why it doesn't read the Result from database!!! You are right about the grid option. It looks more logical for 100 Labels! But I have made an image and put

Re: [Gambas-user] make Label background from Database field

2009-10-16 Thread Dimitris Anogiatis
Vassili, you might also want to take a look at The Gridview control http://www.gambasdoc.org/help/comp/gb.qt/gridview and the Tableview control http://www.gambasdoc.org/help/comp/gb.form/tableview perhaps one of those two is a better approach than manipulating individual labels If you still wa

Re: [Gambas-user] make Label background from Database field

2009-10-16 Thread Vassilis K
Since I did not want to make labels on run time, I got a solution to show red color as following: PUBLIC SUB Form_Open() DIM i AS Integer DIM rsThesi AS Result DIM iD AS Long MODMain.Connect() rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax = 0") WHILE iD

Re: [Gambas-user] make Label background from Database field

2009-10-15 Thread Vassilis K
Thanks for the answer Dimitri. You also caught error No 2 with the 2nd solution: $alblTime.Resize(100) FOR iD = 0 TO rsThesi.Count - 1 $alblTime[iD] = NEW Label(ME) $alblTime[iD].Background = Color.Red NEXT MODMain.$Con.Commit() END The form wit

Re: [Gambas-user] make Label background from Database field

2009-10-15 Thread Matti
Just to be sure about a possible error: With this method, you *create* new labels that have nothing to do with any existing label on your form. So, in your FOR...NEXT loop, you have to write .X, .Y, .Widht and .Height information of each label, otherwise you'll never see the new labels. Did yo

Re: [Gambas-user] make Label background from Database field

2009-10-15 Thread Dimitris Anogiatis
Vassili, I'm glad we caught 1 of the two errors now let's go for the next one :) $alblTime[iD] = NEW Label(ME) FOR iD = 1 TO rsThesi.Count - 1 $alblTime[iD].Background = Color.Red NEXT ok this has to be FOR iD = 1 TO rsThesi.Count - 1 $alblTime[iD

Re: [Gambas-user] make Label background from Database field

2009-10-15 Thread Vassilis K
Here is the new routine with all the testings that I tried: PRIVATE $alblTime AS NEW Object[] PUBLIC SUB Form_Open() DIM i AS Integer DIM rsThesi AS Result DIM iD AS Long ME.Title = "Σχέδιο θέσεων Camping" MODMain.Connect() rsThesi = MODMain.$Con.exec("select * from egrafes where el

Re: [Gambas-user] make Label background from Database field

2009-10-15 Thread Matti
The "Out of bounds" error occurs when you haven't told Gambas how many items the array should hold. Just add a $alblTime.Resize(100) before you actually use the array. "100" means how many labels you have. Could be also a variable, like counting files... Regards Matti Vassilis K schrieb: > I c

Re: [Gambas-user] make Label background from Database field

2009-10-15 Thread Dimitris Anogiatis
Vassili, It's not going to work #1 cause you're defining a dynamic array with no apparent bounds #2 it's going to create a synchronization problem that way because if rsThesi!AA is an autoincrement field (unless I'm guessing wrong) and if you delete and add a row then things tend to get a bit mes

Re: [Gambas-user] make Label background from Database field

2009-10-15 Thread Werner
Vassilis K wrote: > I changed it as you said : > > PRIVATE $alblTime AS NEW Object[] > > PUBLIC SUB Form_Open() > DIM i AS Integer > DIM rsThesi AS Result > DIM iD AS Long > > MODMain.Connect() > rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax = > 0") >F

Re: [Gambas-user] make Label background from Database field

2009-10-15 Thread Vassilis K
I changed it as you said : PRIVATE $alblTime AS NEW Object[] PUBLIC SUB Form_Open() DIM i AS Integer DIM rsThesi AS Result DIM iD AS Long MODMain.Connect() rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax = 0") FOR iD = 0 TO rsThesi!AA i = r

Re: [Gambas-user] make Label background from Database field

2009-10-14 Thread Matti
I guess that "Label(["i"])" causes the problem. I don't think you can address them that way, but need an array of labels. Here, it works with PRIVATE $alblTime AS NEW Object[] $alblTime[i] = NEW Label(ME) And then you can address every label with $alblTime[i].Property = xy Regards Matti Vassil

[Gambas-user] make Label background from Database field

2009-10-14 Thread Vassilis K
Hello, I want to change the color of about 100 Labels of a form according to the values of a table in the database. If the value of the field thesi is 12, I want to make Label12 look red (with red background color). For this purpose I made the following : PUBLIC SUB Form_Open() DIM rsThesi AS