[Gambas-user] make Label background from Database field

Dimitris Anogiatis dosida at ...626...
Sun Oct 18 14:11:01 CEST 2009


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_bgcolor(pos as Integer)
   SELECT CASE pos
     CASE 1
        Label1.Background = Color.Red
     CASE 2
        Label2.Background = Color.Red
            .
            .
            .
            .
            .
     CASE 100
       Label100.Backround = Color.Red
     CASE ELSE
   END SELECT
 END

I know this looks tedious to code but the reason why I recommend this is
that with the SELECT CASE, change_bgcolor would do 3 moves in every case
instead of going through the 100 labels you have in your Camp Ground
Scheduling application.

As for the "Result Not Available" message,

let's try this; replace everything from the WHILE line up to the WEND line
with this

   'while the record index is less than the total count of records
   DO WHILE rsThesi.Index < rsThesi.Count

   'change the background color of the label that's in a position reported
in rsThesi!thesi
    change_bgcolor(CInt(rsThesi!thesi))

   'move to the next Record
      rsThesi.MoveNext()
   LOOP

if you still get the "Result Not Available" error then try replacing
rsThesi.Count with an integer
value less than your total records for this query (For example 10) and see
what you get for that.

I hope this helps. Keep up the good work
Hope we can see the finished project soon with screenshots and all :)

Regards,
Dimitris



On Sun, Oct 18, 2009 at 4:11 AM, Kad Mann <nospam.nospam.nospam at ...626...>wrote:

> 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 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.
> > >>>
> > >>>
> > >> "Surely something like that has to be easier" and "surely much better
> > >> and easier control".
> > >> Yes and no
> > >>
> > >
> > > I didn't ask you.
> > >
> > True, and neither Vassilis asked you something... you can't understand
> > him, but I can understand you. In one of your last mail you noticed that
> > data controls don't have all the properties as other textboxes, such
> > alignment and so on. Be prepared for other surprises. Everybody would
> > love to have controls with lots of properties in order to do everything
> > you want, but this is impossible (can you believe it? Once you have put
> > 100 properties in a control, you will find someone asking for the #101).
>
> Of course, the point is, I didn't ask for the features. Did I? I asked
> is the limitation by design, are there plans to change it, and is there
> a workaround.
>
> Besides, do you feel it is unreasonable for someone to want "a box used
> to show the contents of a Field or edit it", a data-bound control
> intended to save programming time, to have similar functionality to a
> TextBox?
>
> > Real programmers prefer to do things their way, with few versatile
> > mechanisms.
>
> So, who do you believe might not be a real programmer?
>
> >  The more a component gets complicated, the less people
> > understand it; just now, many problems arise from the fact that people
> > don't read documentation, and even when they do, they don't notice some
> > important feature; and often that feature is not exactly you need.
>
> So, you feel that if a DataControl was given similar functionality to a
> TextBox, you might not understand it?
>
> > To Vassilis: I don't know what more to say about your problem. Better to
> > wait for Benoit.
> >
> > Regards to all,
> >
>
>
>
> ------------------------------------------------------------------------------
> 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