[Gambas-user] make Label background from Database field
Dimitris Anogiatis
dosida at ...626...
Sun Oct 18 01:34:06 CEST 2009
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 ")
'move to the first record
rsThesi.MoveFirst
'while the record index is less than the total count of records
WHILE rsThesi.Index < rsThesi.Count
'change the background color of the label that's in a position reported
in rsThesi!thesi
change_bgcolor("Label" & CStr(rsThesi!thesi))
PRINT "Record: " & CStr(rsThesi.Index) & " Result: " &
CStr(rsThesi!thesi)
'if we haven't reached the last record, move to the next one
IF rsThesi.Index < rsThesi.Count THEN
rsThesi.MoveNext()
ENDIF
WEND
END
Not sure if it will work (I might be missing a few key elements of your
code) but theoretically it should do the job
I hope this helps.
Keep up the good work
Regards,
Dimitris
On Sat, Oct 17, 2009 at 4:56 PM, Kad Mann <nospam.nospam.nospam at ...626...>wrote:
> 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 based on the data. Surely something like that has to be
> easier than trying to work out how to manage a hundred labels on a
> screen, and surely it will offer you much better and easier control of
> future UI changes, and surely it will offer a more pleasing and
> intuitive presentation to your user.
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list