[Gambas-user] In search of two features

Kari Laine kari.laine at ...1400...
Sat Mar 8 12:11:48 CET 2008


Hi Rob,

thanks. I hope I had asked this before I wrote that stupid code of mine. 
Anyway this works when I made the LostFocus SUB public.

Best Regards
Kari



Rob kirjoitti:
> On Friday 07 March 2008 14:50, Kari Laine wrote:
>> first I would like to see join command in Gambas. Command would
>> join array elements or collection elements to a string.
> 
> It does, but it's a method of the array, not a stand-alone command.
> 
> mystring = myarray.Join(",") ' would result in comma-separated values
> 
>> second, some kind of indexing for text boxes. I am making a billing
>> program and I have form with the following layout.
> 
> This is a very frequently-requested feature, but I doubt we'll ever 
> see it because populating an array at design time isn't really a 
> great programming practice.
> 
> The way my clients and I have done it is like so (pseudo-code from 
> memory, may not actually compile):
> 
> dim i as integer
> dim o as object
> dim products as new object[]
> 
> for i = 0 to 39
> 	o = new Textbox(ME) as "products"
> 	o.x = 10
> 	o.y = 10 + (20 * i)
> 	o.width = 100
> 	o.height = 16
> 	o.tag = i ' we store the array index in the tag
> 	products.add(o)
> next
> 
> Then you can receive events for your textboxes and handle them 
> appropriately:
> 
> sub products_LostFocus()
> 	dim i as integer
> 	dim o as object
> 	o = last
> 	i = o.tag
> 	if o.text <> "" then
> 		updatedatabase(i, o.text)
> 	endif
> end
> 
> where "sub updatedatabase(productname as string, id as integer)" is a 
> subroutine that would include something like mydb.exec("update 
> mytable set productname = &1 where id = &2", productname, id).
> 
> Rob
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> 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