[Gambas-user] make Label background from Database field

Matti math.eber at ...221...
Fri Oct 16 08:15:21 CEST 2009


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 you do that?

Matti


Dimitris Anogiatis schrieb:
> 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] = NEW Label(ME)
>           $alblTime[iD].Background = Color.Red
>        NEXT
> 
> for it to work.
> 
> because in your approach you only add
> 
>       $alblTime[iD] = NEW Label(ME)
> 
> once... and then you run the for loop. Which will find an object in
> $alblTime[iD]  for iD = 0 (since iD gets the value 0 by default)
> 
> but what about iD=1 or iD=2?
> 
> I would also try to see if $alblTime.Resize(rdThesi.Count) works for you
> 
> if it doesn't work I would change the loop to this and see if this works:
> 
> While iD < rsThesi.Count
>          $alblTime.Add(NEW Label(Me))
>           $alblTime[$alblTime.Count - 1].Background = Color.Red
>          INC iD
> WEND
> 
> it does the same thing as the for loop. And it should work... theoretically
> :)
> 
> I hope it helps
> Keep up the good work
> 
> Regards,
> Dimitris
> 
> On Thu, Oct 15, 2009 at 3:51 PM, Vassilis K <vkan53 at ...2300...> wrote:
> 
>> 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 elenchosAnax =
>> 0")
>>        $alblTime.Resize(100)
>>       $alblTime[iD] = NEW Label(ME)
>>         FOR iD = 1 TO rsThesi.Count - 1
>>           $alblTime[iD].Background = Color.Red
>>         NEXT
>>    MODMain.$Con.Commit()
>> END
>>
>> I get the error c
>> I 'll continue testing!
>>
>> You are right about the loop variant Dimitri. It must be rdThesi.Count-1.
>>
>> ------------------------------------------------------------------------------
>> 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
>>
> ------------------------------------------------------------------------------
> 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