[Gambas-user] Re: Columnview key

Benoit Minisini gambas at ...1...
Wed Dec 28 12:03:50 CET 2005


On Tuesday 27 December 2005 20:43, Rohnny Stormo wrote:
> Hi Benoit.
>
> It's not more than one key I want. I want to retrive the key from one
> line in the columview.
>
> It was ment to use time value then they will not crash when adding. I
> have used
> number now since it's not working other way.
>
> The number between () are keys.
> key-productnr - description-price-quant-discount-total
> (1) -01234- 02.12.2005 - product description-123-2-0-246
> (2) -01234- 03.12.2005 - product description-123-2-0-246
> (3) -01234- 07.12.2005 - product description-123-2-0-246
> (8) -01234- 15.12.2005 - product description-123-2-0-246
> (9) -01234- 18.12.2005 - product description-123-2-0-246
>
> ----------------------------
>
>
> As you see missing 4-7 that because as user I did a mistake and went back
> delete the line and added a new one. Or maybee customer did not want the
> product after all, so it need to be deleted. You know all those yellow
> papers on the
> desk :D
>
> Now I loop trough 1-keycount (9)
> for i = 1 to keycount
> if columnview1[i].exist = true then
>     do something with columns
>     col1 = columnview1[i][0]
>     col2 = columnview1[i][1]
>     col3 = columnview1[i][2]
>     col4 = columnview1[i][3]
>     col5 = columnview1[i][4]
>     col6 = columnview1[i][5]
> end if
>
> What I wanted was
>    dim key
> for i = 0 to columnview1.count -1
>     key = columnview.item[i].key
>     '
>     col1 = columnview1[key][0]
>     col2 = columnview1[key][1]
>     col3 = columnview1[key][2]
>     col4 = columnview1[key][3]
>     col5 = columnview1[key][4]
>     col6 = columnview1[key][5]
> next
>
> I also need to go trough all after adding one more line to add a total,
> vat and total inc vat to the screen
>
> Think the last one would be safer and faster. If I make a mistake and
> forgett
> to zero keycounter then hell brake loose. I know I should not forgett
> that :D
>
>
> Regards Rohnny
>

If you just need browse the column view, you have to do that:

ColumnView1.MoveFirst
WHILE ColumnView1.Available
  key = ColumnView1.Item.Key
  col1 = ColumnView1.Item[0]
  col2 = ColumnView1.Item[1]
  ...
  ColumnView1.MoveNext
WEND

Regards,

-- 
Benoit Minisini





More information about the User mailing list