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

Home » Public Forums » archive » Widget programing - Please help!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Widget programing - Please help! [message #85854] Fri, 13 September 2013 21:46 Go to previous message
moxament is currently offline  moxament
Messages: 26
Registered: April 2008
Junior Member
Deal All,

I am writing a simple widget program in IDL where the user is to select between two files: file one and file two. The code is below:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;
pro span, event
compile_opt idl2

;Define the main widget and its childs
main = WIDGET_BASE(Title = "Select Input File", XSIZE=260, /COLUMN)

values = ["file one", "file two"]
select = CW_BGROUP(main, values, /EXCLUSIVE)

line = WIDGET_BASE(main,column=3)
okay = WIDGET_BUTTON(line,VALUE=' Okay ',xsize=120)
cancel = WIDGET_BUTTON(line,VALUE=' Cancel ', xsize=120)

;Realize the widget
WIDGET_CONTROL, main, /REALIZE, tlb_get_size = tlb_size
WIDGET_CONTROL, select, GET_VALUE=val
screen_dim = GET_SCREEN_SIZE()
WIDGET_CONTROL, main, xoffset = screen_dim[0]/2 - fix(tlb_size[0]/2), yoffset = screen_dim[1]/2 - fix(tlb_size[1]/2)

event1 = WIDGET_EVENT(line)
CASE event1.id of
cancel: widget_control, event1.top, /destroy
okay : begin
event2 = WIDGET_EVENT(select)
WIDGET_CONTROL, select, GET_VALUE = val
if val eq 0 then print, "file one selected"
if val eq 1 then print, "file two selected"

end
endcase
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;

Now, my question is that how can I include the case where the user might click by mistake the button "Okay" without the selection of any of the two files. In case of this mistake by the user, I would like an error message to appear and say:

"ERROR: Please select one of the two files"

Your help is appreciated!

Khal.
[Message index]
 
Read Message
Read Message
Previous Topic: IDL implementation of SHA1 checksum
Next Topic: QSIMP function

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

Current Time: Fri Oct 10 04:58:29 PDT 2025

Total time taken to generate the page: 1.99765 seconds