X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 27 Nov 2014 12:07 AM by  anon
How do I check if a widget_table is empty?
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:32
New Member


--
27 Nov 2014 12:07 AM
    Lets say I used WIDGET_TABLE created a table but not yet input any data. I tried to use "WIDGET_CONTROL, MyTable, GET_VALUE=MyValue" and expect MyValue should return an empty array. But instead, MyValue returned a 6 by 6 array. What is the right way to check if the table is empty?

    Deleted User



    New Member


    Posts:81
    New Member


    --
    01 Dec 2014 12:14 PM
    When you realize a table widget whose elements have not yet been assigned a value, retrieved element values would be expected to be empty strings, as inferred by the following note in the IDL Help description for the VALUE keyword to WIDGET_TABLE: "Note: If the VALUE keyword is not specified, the data in the created table will be of type STRING." (See: http://www.exelisvis.com/docs/WIDGET_...) For example: IDL> wb = widget_base(/col) IDL> wt = widget_table(wb, xsize=3, ysize=3) IDL> widget_control, wb, /realize IDL> widget_control, wt, get_value=vals IDL> help, vals VALS STRING = Array[3, 3] IDL> help, vals[0, 0] STRING = '' Assuming then that an array of empty strings is an indication that the table has not yet been initialized, below is subsequent code that might indicate the status of the table widget "wt" from the example above: if isa(vals, 'string') then begin test = strjoin(vals, /single) if test eq '' then $ print, 'Table has not been initialized.' $ else $ print, 'Table has been initialized' endif else $ print, 'Table has been initialized' I hope this can be helpful. -Jim

    Deleted User



    New Member


    Posts:32
    New Member


    --
    10 Dec 2014 09:15 PM
    Jim, thanks much.
    You are not authorized to post a reply.