Hello Alex,
This is what you can do :
default = 2011
question = string(default, format='(" Do You Want to Use Default Value : ", i4)')
res = dialog_message(question, /question) ; Ask to User what he wants to do
promptVar = ''
if res eq 'Yes' then value = default else begin ; If he wants to use a non-default value he will need to define it.
while (stregex(promptVar, '^[0-9]+$', /boolean) ne 1) do $
READ, promptVar, PROMPT='User Value: '
value = uint(promptVar) ; Performing a Cast form String to interger
endelse
; OR
default = 2011
question = string(default, format='(" do you Wan to use Default Value :", i4," (Yes/No) : ")')
promptVar = ''
READ, promptVar, PROMPT=question
if (strupcase(promptVar) eq 'YES') or (strupcase(promptVar) eq '') then value = default else begin
promptVar = ''
while (stregex(promptVar, '^[0-9]+$', /boolean) ne 1) do $
READ, promptVar, PROMPT='User Value: '
value = uint(promptVar) ; Performing a Cast form String to interger
endelse
print, value
END
Cheers,
Vincent
|