comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Updating a WIDGET_TABLE
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Updating a WIDGET_TABLE [message #65732] Sun, 22 March 2009 19:39
edwinretana is currently offline  edwinretana
Messages: 11
Registered: March 2009
Junior Member
On Mar 22, 6:39 am, "ben.bighair" <ben.bigh...@gmail.com> wrote:
> On Mar 22, 1:39 am, edwinret...@gmail.com wrote:
>
>
>
>> Hi
>
>> I'm new using Idl so I need I little bit of help...
>
>> When I try to update a   WIDGET_TABLE :
>
>>  data = DINDGEN(57,2)
>>  data_table= widget_table(col,uvalue= 'table',value=data)
>
>> With this :
>
>> widget_control, state.table, /ALL_TABLE_EVENTS,set_value = ( E)
>
>> E is :  E = dblarr(num,2)
>
>> I get this error :
>
>> WIDGET_CONTROL: Expression must be a scalar or 1 element array in this
>>                   context: <DOUBLE    Array[57,2]>.
>
>> The command widget_control why does not update the widget table
>> values ?
>
> Hi,
>
> I am not sure why it doesn't work for you. You might need to write a
> verys simple example that doesn't work and post that. On the other
> hand, I am certain that I could not display 57 columns across my
> screen (but I have a tiny laptop.)  Are you sure you want 57 columns?
>
> The code pasted below works for me.  You might try separating your
> calls to WIDGET_CONTROL by changing the event handling in one and the
> data in another.
>
> Ben
>
> ****START
> PRO Table_Test_Button_Event, ev
>
>   WIDGET_CONTROL, ev.top, GET_UVALUE = info
>   if (ARRAY_EQUAL(info.dim, [3,5])) then begin
>     info.dim = [3,7]
>     value = REVERSE(FINDGEN(3,7))
>   endif else begin
>     info.dim = [3,5]
>     value = FINDGEN(3,5)
>   endelse
>   WIDGET_CONTROL, info.tableID, SET_VALUE = value, $
>     XSIZE = info.dim[0], YSIZE = info.dim[1]
>   WIDGET_CONTROL, ev.top, SET_UVALUE = info
>
> END
>
> PRO Table_Test
> x = FINDGEN(3,5)
> tlb = WIDGET_BASE(/COLUMN)
> table = WIDGET_TABLE(tlb, value = x)
> button = WIDGET_BUTTON(tlb, value = "Change Data",$
>    EVENT_PRO = "Table_Test_Button_Event")
> WIDGET_CONTROL, tlb, $
>   SET_UVALUE = {TABLEID: table, BUTTONID: button, DIM: [3,5]}
> WIDGET_CONTROL, tlb, /REALIZE
> XMANAGER, "Table_Test", tlb
> END
> ****END

Thanks. I see your code and fix the problem.
Re: Updating a WIDGET_TABLE [message #65740 is a reply to message #65732] Sun, 22 March 2009 05:39 Go to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On Mar 22, 1:39 am, edwinret...@gmail.com wrote:
> Hi
>
> I'm new using Idl so I need I little bit of help...
>
> When I try to update a   WIDGET_TABLE :
>
>  data = DINDGEN(57,2)
>  data_table= widget_table(col,uvalue= 'table',value=data)
>
> With this :
>
> widget_control, state.table, /ALL_TABLE_EVENTS,set_value = ( E)
>
> E is :  E = dblarr(num,2)
>
> I get this error :
>
> WIDGET_CONTROL: Expression must be a scalar or 1 element array in this
>                   context: <DOUBLE    Array[57,2]>.
>
> The command widget_control why does not update the widget table
> values ?
>

Hi,

I am not sure why it doesn't work for you. You might need to write a
verys simple example that doesn't work and post that. On the other
hand, I am certain that I could not display 57 columns across my
screen (but I have a tiny laptop.) Are you sure you want 57 columns?

The code pasted below works for me. You might try separating your
calls to WIDGET_CONTROL by changing the event handling in one and the
data in another.

Ben

****START
PRO Table_Test_Button_Event, ev

WIDGET_CONTROL, ev.top, GET_UVALUE = info
if (ARRAY_EQUAL(info.dim, [3,5])) then begin
info.dim = [3,7]
value = REVERSE(FINDGEN(3,7))
endif else begin
info.dim = [3,5]
value = FINDGEN(3,5)
endelse
WIDGET_CONTROL, info.tableID, SET_VALUE = value, $
XSIZE = info.dim[0], YSIZE = info.dim[1]
WIDGET_CONTROL, ev.top, SET_UVALUE = info

END


PRO Table_Test
x = FINDGEN(3,5)
tlb = WIDGET_BASE(/COLUMN)
table = WIDGET_TABLE(tlb, value = x)
button = WIDGET_BUTTON(tlb, value = "Change Data",$
EVENT_PRO = "Table_Test_Button_Event")
WIDGET_CONTROL, tlb, $
SET_UVALUE = {TABLEID: table, BUTTONID: button, DIM: [3,5]}
WIDGET_CONTROL, tlb, /REALIZE
XMANAGER, "Table_Test", tlb
END
****END
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Help Finding Sources (Peaks) in an Image
Next Topic: Help and Ideas about Plotting...

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:45:09 PDT 2025

Total time taken to generate the page: 1.03847 seconds