[Gambas-user] make Label background from Database field

Doriano Blengino doriano.blengino at ...1909...
Sun Oct 18 17:16:18 CEST 2009


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 not much faster, 
> because it compares case by case until it finds a match, and then exits. 
> For this purpose, I forget to put a return in my subroutine just after 
> the match (when the test is true). Doing so, I bet the speed is comparable.
>   
I forgot again...

if speed is really important, you can "cache" the results from the 
routine, ie create an array of labels, and assign them once using either 
methods (select or loop). Then you use the database value as an index in 
the array, and obtain in just one instruction the reference for the 
label. About 50 times faster...

Hope it is clear.

Best regards,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."





More information about the User mailing list