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

Home » Public Forums » archive » Re: changing button text for dialog_message
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: changing button text for dialog_message [message #38769] Tue, 30 March 2004 11:57 Go to next message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
Tim Williams wrote:
> Is there a way to change the text in the buttons for dialog_message
> from Yes/No to something else? I have an application where I want to
> prompt the user to do one of two things. Dialog_message(/question)
> seems to fit the bill, except I'd rather have something instead of
> Yes/No e.g. 'Do this'/'Do that'.
>
> Thanks.

Would this do it? It's just a quick hack - so caveat emptor.

IDL> print, dialog_Choice(['yes', 'no', 'maybe'], message = 'Well??')

maybe




*****START****
PRO Dialog_Choice_Event, ev


Widget_Control, ev.ID, Get_Value = thisChoice

Widget_Control, ev.Top, get_Uvalue = thisOne
*thisOne = thisChoice

Widget_Control, ev.Top, /destroy

END



FUNCTION Dialog_Choice, buttonNames, $
MESSAGE_TEXT = message_text, $
GROUP_LEADER = group_leader, $
TITLE = title



If n_elements(title) EQ 0 then $
title = 'Please make a selection'

if n_elements(message_text) EQ 0 then $
message_text = 'Please make a selection'


if n_elements(buttonNames) EQ 0 then buttonNames = 'OK'

n_Choices = n_elements(buttonNames)


doModal = ( n_elements(group_Leader) EQ 0 ) ? 0 : 1
base = widget_base(group_Leader = group_leader, $
title = title, $
Column = 1, $
/Base_align_Center)

label = Widget_Label(base, $
value = message_text, $
/align_Center)


weeBase = Widget_Base(base, $
Column = n_Choices, $
/base_align_center)
For i = 0L, n_Choices-1 Do $
button = WIDGET_BUTTON(weeBase, $
Value = buttonNames[i], $
Event_Pro = 'Dialog_Choice_Event', $
uValue = buttonNames[i])


ThisOne = Ptr_NEW("")
Widget_Control, base, Set_Uvalue = thisOne
Widget_Control, base, /realize

XMANAGER, 'DIALOG_CHOICE', base

returnChoice = *thisone
Ptr_Free, thisOne
Return, returnChoice
END
******FINISH
Re: changing button text for dialog_message [message #38855 is a reply to message #38769] Wed, 31 March 2004 05:26 Go to previous message
timothy.williams is currently offline  timothy.williams
Messages: 20
Registered: October 2001
Junior Member
Ben Tupper <btupper@bigelow.org> wrote in message news:<c4cjfj$2h32a0$1@ID-189398.news.uni-berlin.de>...
> Tim Williams wrote:
>> Is there a way to change the text in the buttons for dialog_message
>> from Yes/No to something else? I have an application where I want to
>> prompt the user to do one of two things. Dialog_message(/question)
>> seems to fit the bill, except I'd rather have something instead of
>> Yes/No e.g. 'Do this'/'Do that'.
>>
>> Thanks.
>
> Would this do it? It's just a quick hack - so caveat emptor.
>
> IDL> print, dialog_Choice(['yes', 'no', 'maybe'], message = 'Well??')
>
> maybe
>
(snip)

I guess so. I was really trying to avoid writing another routine that
would be just like dialog_message. I guess I was hoping for some
undocumented keywords like

result=dialog_message("Modify or delete?", /question, /cancel, $
button0='Modify', button1='Delete')
case result of
'Modify':begin
;modify something
end
'Delete':begin
;just delete it
end
'Cancel':break
endcase

I'm using the standard 'Yes/No' now to do what I want, but it would be
nice to be able to just relabel the buttons.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Is it possible a transparent image in space ???
Next Topic: Re: How to set elements of arrays as blank (not zero)?

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

Current Time: Wed Oct 08 11:00:19 PDT 2025

Total time taken to generate the page: 0.00510 seconds