CW_FIELD question [message #54234] |
Fri, 25 May 2007 11:01  |
markb77
Messages: 217 Registered: July 2006
|
Senior Member |
|
|
I know there must be something basically wrong with my thinking on
this, but I can't figure out why this doesn't work. I'm writing a
program that makes use of DRAW and TEXT widgets without an event
handling routine. I would like some widgets to be used as numeric
entry fields in which the user can enter numeric data to be read by
the program. These should not be modal widgets.
Here is an example of what I'm trying to do:
PRO Example
tlb = Widget_Base(Column=1)
field1 = WIDGET_TEXT(tlb, /EDITABLE)
field2 = CW_FIELD(tlb, /FLOATING)
WIDGET_CONTROL, tlb, /REALIZE
XManager, 'example', tlb, /No_block
quita = 0
curval=''
WIDGET_CONTROL, field1, GET_VALUE=curval
while quita ne 1 do begin
WIDGET_CONTROL, field1, GET_VALUE=f1val
WIDGET_CONTROL, field2, GET_VALUE=f2val
if f1val ne curval then begin
curval = f1val
print, curval
print, f2val
if curval eq 'q' then quita = 1
endif
wait, 0.1
endwhile
WIDGET_CONTROL, tlb, /DESTROY
END
When you run this program, the WIDGET_TEXT field is editable and
behaves as expected, but the CW_FIELD field is not editable. What is
going on? There must be something basic that I'm missing here.
Thanks,
Mark
|
|
|
Re: cw_field question [message #63591 is a reply to message #54234] |
Thu, 13 November 2008 17:07  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Marshall Perrin writes:
> Once a CW_FIELD has been created, is there any easy way to
> change its title? Calls to widget_control let you get or set
> the field's value, but as far as I can tell not the title...
>
> I suppose I can just modify the CW_FIELD code myself to allow this,
> but it seems kind of odd that it can't be done easily by default.
> Likewise, it appears impossible to change the validation type
> (float, int, etc) once the field has first been created. Am I
> missing something?
I think you missed FSC_INPUTFIELD:
http://www.dfanning.com/programs/fsc_inputfield.pro
It does everything you want and much, much more. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|