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 
Return to the default flat view Create a new topic Submit Reply
Re: changing button text for dialog_message [message #38769] Tue, 30 March 2004 11:57 Go to previous 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
[Message index]
 
Read Message
Read Message
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 14:58:52 PDT 2025

Total time taken to generate the page: 0.00224 seconds