[Gambas-user] Gambas "Best Practices"

charlesg charles at ...1784...
Tue May 20 08:10:00 CEST 2008


This might be a case of blind leading blind but hey, somebody will correct me
if I am wrong.

QT will be selected by default if you use KDE, GTK+ if you use Gnome. The
Gambas IDE itself uses QT so you can't escape that even on Gnome. I don't
know if a runtime GTK+ contains any QT remnants resulting from the IDE.

QT usage on Gambas is the original. GTK is being offered because of the
legal restrictions on commercial distribution of products using QT. Have a
look at the Trolltech website for the eyewatering prices.

GTK based products currently have the disadvantage (at least for data hacks)
that there is no reporting facility although there is an idiot-workaround
(search GTK and printing here).

As for the name search: I have not used your size datasets but have been
amazed at the speed of the following. Typing text into a TextBox filters the
displayed data in the ListBox. I guess it would be even quicker if you (in
your case) searched from the start of each data record rather than using
instr. A click of the ListBox can then transfer the complete data back to
the TextBox.
------------------------------------------------
PUBLIC SUB txtName_keyRelease()
  DIM txtUpper AS String
  DIM txtList AS String
  
  IF key.Code = key.Return OR key.Code = key.Enter OR key.Code = key.Tab
THEN
    'go nowhere if field is blank. This does not stop you tabbing out of an
empty field
    'so must still check for valid fields when <add> is clicked.  
    IF IsNull(txtName.text) THEN 
      txtName.SetFocus
    ELSE 'go to next field
      txtDate.SetFocus
    ENDIF 
  ELSE 'filter the listbox to allow entries containing the txtfield text.
      IF Len(txtname.Text) = 0 THEN 
         ListFill 'subroutine to default fill with all the data
      ELSE 
         txtUpper = UCase(txtName.Text)
         lstSupplier.Clear
         FOR EACH res
            IF InStr(UCase(res!p_desc), txtUpper) <> 0 THEN 
               lstSupplier.Add(Format(res!p_box, "00") & ", " &
Format(res!p_number, "0000") & ", " & res!p_desc & ", " & res!p_date & ", "
& res!p_wherefrom)
            ENDIF 
         NEXT
      ENDIF          
  ENDIF 
END
---------------------------------------------------------------------
-- 
View this message in context: http://www.nabble.com/Gambas-%22Best-Practices%22-tp17323065p17333857.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list