Professional IronPython


Defining Simple Message Boxes



Download 20,35 Mb.
Pdf ko'rish
bet379/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   375   376   377   378   379   380   381   382   ...   453
Defining Simple Message Boxes
Message boxes (created using the 
MessageBox
class) are extremely useful for displaying short messages 
and getting canned responses. Depending on the buttons you provide, a user could tell you that the 
application should retry an operation or answer yes to simple questions. If you need a little more input, 
you can always rely on an input box (created with the 
InputBox()
method of the 
Interaction
class). 
Of course, an input box is still limited to a single field, but even so, it does extend the kinds of input 
you can receive from the user.
Listing 17-3 demonstrates both the 
MessageBox.Show()
and 
InputBox()
methods. In addition, 
you’ll see how to implement the 
__doc__()
method that most IronPython developers rely upon to 
obtain information about your extension. The section “Considering Developer Help” in Chapter 16 
provides additional information about developer help needs.
548592c17.indd 368
2/24/10 12:49:35 PM
www.finebook.ir


Using Visual Basic.NET for User Interface Support
 

 
369
The content of the 
Interaction
 class is something that some Visual
Basic.NET developers tend to forget. These methods, such as 
Beep()
, are useful 
in IronPython. Visual Basic.NET developers get these features automatically as 
part of the 
Microsoft.VisualBasic
 namespace. Other language developers, 
such as C#, can use these features, too, but will need to add a reference to 
Microsoft.VisualBasic.DLL
 and provide the proper 
using
 statements.
LISTINg 17-3: 
 Working with simple message boxes
Imports System.Windows.Forms
Public Class Dialogs
Public Function ShowMessage(ByVal Msg As String) As String
Return MessageBox.Show(Msg).ToString()
End Function
Public Function ShowMessage(ByVal Msg As String, _
ByVal Title As String) As String
Return MessageBox.Show(Msg, Title).ToString()
End Function
Public Function ShowMessage(ByVal Msg As String, ByVal Title As String, _
ByVal Buttons As Int16) As String
Return MessageBox.Show(Msg, Title, CType(Buttons, MessageBoxButtons) _
).ToString()
End Function
Public Function ShowMessage(ByVal Msg As String, ByVal Title As String, _
ByVal Buttons As Int16, ByVal Icon As Int16 _
) As String
Return MessageBox.Show(Msg, Title, CType(Buttons, MessageBoxButtons), _
CType(Icon, MessageBoxIcon)).ToString()
End Function
Public Function ShowMessage(ByVal Msg As String, ByVal Title As String, _
ByVal Buttons As Int16, ByVal Icon As Int16, _
ByVal DefaultButton As Int16) As String
Return MessageBox.Show(Msg, Title, CType(Buttons, MessageBoxButtons), _
CType(Icon, MessageBoxIcon), _
CType(DefaultButton, MessageBoxDefaultButton) _
).ToString()
End Function
Public Function GetInput(ByVal Msg As String, ByVal Title As String)
Return InputBox(Msg, Title, “Type a value”)
continues
548592c17.indd 369
2/24/10 12:49:35 PM
www.finebook.ir



Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   375   376   377   378   379   380   381   382   ...   453




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish