mr_unreliable
Sat Mar 15 21:50:48 CDT 2008
This is a multi-part message in MIME format.
--------------070508040105000300010906
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Martin Glodde wrote:
> Alternatively, is there any way to bring up a MsgBox where I can
> actually customize the reply buttons? So far, I only saw options like
> "Yes", "No" and "Cancel".
>
Martin, if you are courageous enough, or foolhardy enough to
be willing to use a 3rd-party control, then there are several
utilities which will allow you to show any graphic (GUI) that
you can think of. For example:
kixForms (written by: Shawn Tassie of CGI Canada):
http://www.kixforms.org/assets/index.htm
wshDialog (written by: Peter J.C. van der Klugt):
http://home.hccnet.nl/p.vd.klugt/,
These 3re-party controls must be downloaded, installed and
registered, but then you can GUI-it-up as far as your
imagination can carry you.
There is a demo attached, using KixForms to show a dialog
with some option buttons (a.k.a. radio buttons)...
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)
--------------070508040105000300010906
Content-Type: text/plain;
name="wshSimpleKixFormsDemo.vbs.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="wshSimpleKixFormsDemo.vbs.txt"
' wshSimpleKixFormsDemo Script, jw 15Mar08
'
' Author: mr_unreliable
' Usage: Use at you own risk, tested on win98se...
'
Dim oKixSystem : Set oKixSystem = CreateObject("Kixtart.System")
' Set Up the Top-Level Container (called "the Form Object")
Dim oForm : Set oForm = oKixSystem.Form()
Dim oBtn, oLbl, oRB1, oRB2, oRB3 ' as object(s)
Dim sUserSelection ' as string
Dim bCloseEvent ' as boolean
' --- end of global variables --------------------
' ================================================
' === MAIN LINE SCRIPT LOGIC HERE ================
' ================================================
Call Create_Dialog() ' using kixforms
bCloseEvent = False
Do
WScript.Sleep 100
' --- discussion of event processing ----------
' o.k., can't say how this works exactly. The Documentation says:
' "DoEvents returns a string representing the next event in the queue".
' Apparently that string referred to is the string stored in the event
' property. For example: say a click event is detected, then the
' DoEvents method will return the string stored in the onClick property.
' Then that string (retrieved by DoEvents) gets executed here...
'
' As to the DoEvents "wait" parameter, according to the documentation:
' false means process an event if one is detected, but otherwise DON'T WAIT for an event.
' true means wait (i.e., don't return until there is some event to report).
' But here, it seems to work JUST THE OPPOSITE from what the doc says.
' Ain't this fun...
' --- end of discussion ----------------------
Execute(oForm.DoEvents(True)) '
Loop Until (bCloseEvent)
' o.k., the demo is finished, now exit gracefully...
oRB1.Visible = False ' hide the controls
oRB2.Visible = False
oRB3.Visible = False
oBtn.Visible = False
oLbl.Text = "the demo is finished"
WScript.Sleep 1000
oLbl.Text = "this dlg will close in 2ses"
WScript.Sleep 2000
oForm.Visible = False
Set oForm = nothing
Set oKixSystem = nothing
WScript.Quit
' ================================================
' === SUBROUTINES FOLLOW =========================
' ================================================
Sub oForm_Click()
MsgBox("form click detected(!)")
End Sub
Sub oBtn_Click()
MsgBox("your selection was: " & sUserSelection & vbCrLf & vbCrLf _
& " the script will now close... ")
bCloseEvent = True
End Sub
Sub Create_Dialog()
With oForm
.Text = " How would you like to ""group"" your stuff... " ' the form caption
.MinimizeBox = "False"
.MaximizeBox = "False"
.Resizable = 0
.BackColor = "Azure" ' &HD0D0D0 ' Lt Gray
.Width = 300
.Height = 160
.FontName = "Verdana"
.FontBold = True
.FontSize = 10
.onClick = "oForm_Click()"
Set oLbl = .Controls.Add("Label")
With oLbl
.Left = 20 : .Top = 10 : .Width = 270 : .Height = 15
.Text = "Group Criteria... "
End With ' olbl
' add a "radiobutton" (aka option button) to the form...
Set oRB1 = .Controls.Add("RadioButton")
With oRB1
.Left = 20 : .Top = 30 : .Width = 180 : .Height = 20
.BackColor = oForm.BackColor
.FontSize = 9
.FontBold = False
.Text = "Date"
.Checked = True ' select as default
sUserSelection = oRB1.Text ' default result
.onClick = "sUserSelection = oRB1.Text" ' (onEvent, do this)
End With ' oRB1
Set oRB2 = .Controls.Add("RadioButton") ' another radio button
With oRB2
.Left = 20 : .Top = 50 : .Width = 180 : .Height = 20
.BackColor = oForm.BackColor
.FontSize = oRB1.FontSize : .FontBold = oRB1.FontBold
.Text = "Measurement"
.onClick = "sUserSelection = oRB2.Text"
End With ' oRB2
Set oRB3 = .Controls.Add("RadioButton") ' another radio button
With oRB3
.Left = 20 : .Top = 70 : .Width = 180 : .Height = 20
.BackColor = oForm.BackColor
.FontSize = oRB1.FontSize : .FontBold = oRB1.FontBold
.Text = "Process"
.onClick = "sUserSelection = oRB3.Text"
End With ' oRB3
' add a button to the form...
Set oBtn = .Controls.Add("Button")
With oBtn
.Left = 60 : .Top = 100 : .Width = 190 : .Height = 20
' .BackColor = &HFF ' this doesn't seem to work
.FontSize = 9
.FontBold = False
.Text = "Submit Grouping Selection"
.onClick = "oBtn_Click()" ' click event handler
End With ' obtn
.Show ' show the form
End With ' oform
End Sub
--------------070508040105000300010906--