RebGUI table

Discussion in 'Rebol' started by MaxV, May 27, 2011.

  1. MaxV

    MaxV Member

    Hello,
    here my problem:
    if a use a table in rebgui, I can access the block of the table with /selected refinement; but I can't acces to the single value! It's very strange to me, see this example:
    Code:
    print a_table/selected
    ==  1 $3 Mario
    
    probe a_table/selected
    ==  [ 
    1 $3 "Mario"
    ]
    
    print type? a_table/selected
    == block!
    
    foreach item a_table/selected [ 
      print type? item ]
    == integer!
    == money!
    == string!
    
    a_table/selected/1
    ==1 $3 Mario
    
    a_table/selected/2
    ==1 $3 Mario
    
    a_table/selected/3
    ==1 $3 Mario
    
    
    How can I access only to "Mario"?
  2. Graham

    Graham Developer Staff Member

    From memory 'selected is a function so you have to

    Code:
    pick table/selected 3
    
  3. MaxV

    MaxV Member

    Thanks Graham, you're always the number 1!
    However, to help people, I'll write here something that it's not so obvious with table in RebGUI:
    creating table
    Code:
    a: table options ["Column 1 heading" left .5 "Column 2 heading" left .5] data [a b c d ]
    
    accessing data (image the second row selected)
    Code:
    a/selected
    ==  [ c d]
    
    a/picked
    == 2
    
    adding row
    Code:
    a/add-row [e f ]
    
    removing row
    Code:
    a/remove-row 2
    
    modifing row
    Code:
    a/alter-row 2 [g h ]
    

Share This Page