[Gambas-user] GAMBAS rules! (And a couple of questions about listboxes and control "arrays")

Fabien Bodard gambas.fr at ...626...
Thu Dec 31 18:33:40 CET 2009


2009/12/31 Bill Richman <bill at ...2350...>:
> First off, I'd like to say that I really, _really_ like GAMBAS.  I was
> pulling my hair out trying to do something with Open Office macros when
> I discovered GAMBAS.  I went from taking stabs in the dark at methods
> and properties to an auto-prompting system with a really great IDE.
> Many thanks to those who developed it and shared it with the rest of us!
>
> Now, the questions... :-)
>
>
> #1) I've got a form with 144 code-generated tool buttons on it, with
> pictures assigned to them.  The code that generates them inserts an
> "index" number in each button's "tag" property, and I use that to know
> which button generated an event.  Now, however, I need to be able to
> dynamically change the picture assigned to individual buttons.  How do I
> address a specific button in the group?  I suppose I can iterate through
> all the tool button class objects on the form and test each one to see
> if its tag matches the one that came from LAST.tag, but this seems very
> inefficient.  Is there a better way?  I've been searching the mailing
> list archive, but most of the questions about control arrays seem to
> deal more with getting all the controls to trigger the same event and
> the like.
>

use an object array and store all the object in it.


For i = 0 to 144
hButton = New Button(me) as "button"
hButton.Tag = i
aButtons.Add(hButton)

Next


aButtons[40].Text


> #2) I've got a list of names, each of which has a number associated with
> it.  I want the user to be able to select a name from a ListBox control
> and get the associated number.  These are in an SQLite database, so I'd
> thought about looking up the name and returning the number, but since
> the names are entered by the user on another form and can be anything,
> there's a chance they could enter the same name in more than one record
> and confuse things.  I'd like to have a "hidden" column in the ListBox
> (or another ListBox that's hidden?) that contains the numbers, and that
> scrolls and selects "in sync" with the displayed list of names.  I
> suppose I could insert the numbers in front of the names in the listbox,
> and then parse them back out when the user makes a selection, but I'd
> rather not have them visible.  Any ideas?

yes use a sql request ...

hresult = db.exec("SELECT id, name FROM mytable GROUP BY name")

''then use a listview

For each hResult

ListView1.add(hResult!id, hResult!name)

next

Public sub ListView1_Click()
  print ListView1.Current.key
End


> #3) My ListBoxes roll smoothly up and down from one list item to
> another, like movie credits rolling by, and it's really slow.  If I were
> the user, this would make me crazy.  Is there a way to get them to "jump
> scroll" instead of "smooth scroll"?  :-$

?????
i think this not depend on Gambas but on qt or gtk

> Any suggestions would be most welcome.
>
> --
> Bill Richman - Lincoln, Nebraska
> Tilter at windmills, maker of pies in the sky, & curmudgeon
> email: bill at ...2351...  web: www.timeguy.com/bill
>
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> 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