Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/TaskDialog Test
Function:
Required plugins for this example: MBS Main Plugin, MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/TaskDialog Test
This example is the version from Sat, 6th May 2016.
Project "TaskDialog Test.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control WindowTitle Inherits TextField
ControlInstance WindowTitle Inherits TextField
End Control
Control MainInstruction Inherits TextField
ControlInstance MainInstruction Inherits TextField
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Control Content Inherits TextField
ControlInstance Content Inherits TextField
End Control
Control Label4 Inherits Label
ControlInstance Label4 Inherits Label
End Control
Control VerificationText Inherits TextField
ControlInstance VerificationText Inherits TextField
End Control
Control Label5 Inherits Label
ControlInstance Label5 Inherits Label
End Control
Control ExpandedInformation Inherits TextField
ControlInstance ExpandedInformation Inherits TextField
End Control
Control Label6 Inherits Label
ControlInstance Label6 Inherits Label
End Control
Control ExpandedControlText Inherits TextField
ControlInstance ExpandedControlText Inherits TextField
End Control
Control Label7 Inherits Label
ControlInstance Label7 Inherits Label
End Control
Control CollapsedControlText Inherits TextField
ControlInstance CollapsedControlText Inherits TextField
End Control
Control Label8 Inherits Label
ControlInstance Label8 Inherits Label
End Control
Control Footer Inherits TextField
ControlInstance Footer Inherits TextField
End Control
Control Label9 Inherits Label
ControlInstance Label9 Inherits Label
End Control
Control PopupIcon Inherits PopupMenu
ControlInstance PopupIcon Inherits PopupMenu
End Control
Control CheckFooterIcon Inherits CheckBox
ControlInstance CheckFooterIcon Inherits CheckBox
End Control
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
Control RunButton Inherits PushButton
ControlInstance RunButton Inherits PushButton
EventHandler Sub Action() run End EventHandler
End Control
Control Label10 Inherits Label
ControlInstance Label10 Inherits Label
End Control
Control CheckCommonButtonOK Inherits CheckBox
ControlInstance CheckCommonButtonOK Inherits CheckBox
End Control
Control CheckCommonButtonYes Inherits CheckBox
ControlInstance CheckCommonButtonYes Inherits CheckBox
End Control
Control CheckCommonButtonNo Inherits CheckBox
ControlInstance CheckCommonButtonNo Inherits CheckBox
End Control
Control CheckCommonButtonRetry Inherits CheckBox
ControlInstance CheckCommonButtonRetry Inherits CheckBox
End Control
Control CheckCommonButtonCancel Inherits CheckBox
ControlInstance CheckCommonButtonCancel Inherits CheckBox
End Control
Control CheckCommonButtonClose Inherits CheckBox
ControlInstance CheckCommonButtonClose Inherits CheckBox
End Control
Control Label11 Inherits Label
ControlInstance Label11 Inherits Label
End Control
Control CheckEnableLinks Inherits CheckBox
ControlInstance CheckEnableLinks Inherits CheckBox
End Control
Control CheckAllowDialogCancellation Inherits CheckBox
ControlInstance CheckAllowDialogCancellation Inherits CheckBox
End Control
Control CheckPositionRelativeToWindow Inherits CheckBox
ControlInstance CheckPositionRelativeToWindow Inherits CheckBox
End Control
Control CheckCanBeMinimized Inherits CheckBox
ControlInstance CheckCanBeMinimized Inherits CheckBox
End Control
Control CheckVerificationEnabled Inherits CheckBox
ControlInstance CheckVerificationEnabled Inherits CheckBox
End Control
Control CheckParent Inherits CheckBox
ControlInstance CheckParent Inherits CheckBox
End Control
Control Label12 Inherits Label
ControlInstance Label12 Inherits Label
End Control
Control CButton1 Inherits TextField
ControlInstance CButton1 Inherits TextField
End Control
Control CButton2 Inherits TextField
ControlInstance CButton2 Inherits TextField
End Control
Control CButton3 Inherits TextField
ControlInstance CButton3 Inherits TextField
End Control
Control CButton4 Inherits TextField
ControlInstance CButton4 Inherits TextField
End Control
Control Label13 Inherits Label
ControlInstance Label13 Inherits Label
End Control
Control RButton1 Inherits TextField
ControlInstance RButton1 Inherits TextField
End Control
Control RButton2 Inherits TextField
ControlInstance RButton2 Inherits TextField
End Control
Control RButton3 Inherits TextField
ControlInstance RButton3 Inherits TextField
End Control
Control RButton4 Inherits TextField
ControlInstance RButton4 Inherits TextField
End Control
Control CheckProgress Inherits CheckBox
ControlInstance CheckProgress Inherits CheckBox
End Control
Sub AddButton(t as TextField, ID as integer) dim s as string = t.Text if s.len > 0 then dim b as new TaskDialogButtonMBS b.Text = s b.ID = id if id > 20 then td.AppendRadioButton b else td.AppendButton b end if end if End Sub
Sub Log(s as string) Listbox1.AddRow s Listbox1.ScrollPosition = Listbox1.ListCount End Sub
Sub LogButtonName(ID as integer) dim b as TaskDialogButtonMBS = td.FindButtonByID(ID) if b <> nil then log " -> "+b.Text end if Select case ID case td.kIDAbort log " -> Abort" case td.kIDCancel log " -> Cancel" case td.kIDIgnore log " -> Ignore" case td.kIDNo log " -> No" case td.kIDOK log " -> OK" case td.kIDRetry log " -> Retry" case td.kIDYes log " -> Yes" case 0 log " -> no button clicked" end Select End Sub
Function LogoWithMask(n as integer) As picture dim p as Picture = LogoMBS(n) dim g as Graphics = p.mask.Graphics g.FillRect 0, 0, g.Width, g.Height g.ForeColor = &cFFFFF g.FillOval 0, 0, g.Width, g.Height g.ForeColor = &c000000 return p End Function
Sub Run() td = new MyTaskDialogMBS td.logWindow = self td.Yield = true td.ExpandFooterArea = true td.Content = content.Text td.CollapsedControlText = CollapsedControlText.text td.ExpandedControlText = ExpandedControlText.text td.ExpandedInformation = ExpandedInformation.text td.Footer = footer.Text td.MainInstruction = MainInstruction.Text td.VerificationText = VerificationText.Text td.WindowTitle = WindowTitle.Text if CheckFooterIcon.Value then dim logo as Picture = LogoWithMask(32) td.FooterIconPicture = logo end if Select case PopupIcon.ListIndex case 0 td.Icon = td.kIconNone case 1 td.Icon = td.kIconWarning case 2 td.Icon = td.kIconError case 3 td.Icon = td.kIconInformation case 4 td.Icon = td.kIconShield case 5 dim logo as Picture = LogoWithMask(32) td.IconPicture = logo end Select if CheckProgress.Value then td.ProgressbarState = td.kProgressbarNormal td.ProgressbarMax = 100 td.ProgressbarValue = 0 end if if CheckCommonButtonCancel.Value then td.CommonButtons = BitwiseOr(td.CommonButtons, td.kCommonButtonCancel) end if if CheckCommonButtonOK.Value then td.CommonButtons = BitwiseOr(td.CommonButtons, td.kCommonButtonOK) end if if CheckCommonButtonYes.Value then td.CommonButtons = BitwiseOr(td.CommonButtons, td.kCommonButtonYes) end if if CheckCommonButtonNo.Value then td.CommonButtons = BitwiseOr(td.CommonButtons, td.kCommonButtonNo) end if if CheckCommonButtonRetry.Value then td.CommonButtons = BitwiseOr(td.CommonButtons, td.kCommonButtonRetry) end if if CheckCommonButtonClose.Value then td.CommonButtons = BitwiseOr(td.CommonButtons, td.kCommonButtonClose) end if if CheckAllowDialogCancellation.Value then td.AllowDialogCancellation = CheckAllowDialogCancellation.Value end if if CheckCanBeMinimized.Value then td.CanBeMinimized = CheckCanBeMinimized.Value end if if CheckEnableLinks.Value then td.EnableHyperlinks = CheckEnableLinks.Value end if if CheckPositionRelativeToWindow.Value then td.PositionRelativeToWindow = CheckPositionRelativeToWindow.Value end if if CheckVerificationEnabled.Value then td.VerificationEnabled = CheckVerificationEnabled.Value end if if CheckParent.Value then td.parent = self end if AddButton CButton1, 11 AddButton CButton2, 12 AddButton CButton3, 13 AddButton CButton4, 14 AddButton RButton1, 21 AddButton RButton2, 22 AddButton RButton3, 23 AddButton RButton4, 24 log "Showing Dialog..." if td.ShowDialog then dim SelectedButton as integer = td.SelectedButton dim SelectedRadioButton as integer = td.SelectedRadioButton log "Button pressed: "+str(SelectedButton) LogButtonName SelectedButton log "Radiobutton pressed: "+str(SelectedRadioButton) LogButtonName SelectedRadioButton log "Verification Checked: "+str(td.VerificationChecked) else log "Showing Dialog failed!" end if End Sub
Property td As MyTaskDialogMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MyTaskDialogMBS Inherits TaskDialogMBS
EventHandler Function ButtonClicked(ID as Integer) As boolean logwindow.Log CurrentMethodName+" ID: "+str(id) End EventHandler
EventHandler Sub Close() logwindow.Log CurrentMethodName End EventHandler
EventHandler Sub Constructed() logwindow.Log CurrentMethodName End EventHandler
EventHandler Sub ExpandButtonClicked(Expanded as Boolean) logwindow.Log CurrentMethodName+" Expanded: "+str(expanded) End EventHandler
EventHandler Sub Help() logwindow.Log CurrentMethodName MsgBox "Sorry, there is no help yet." End EventHandler
EventHandler Sub HyperlinkClicked(link as string) logwindow.Log CurrentMethodName logwindow.Log "Link: "+link ShowURL link End EventHandler
EventHandler Sub Navigated() logwindow.Log CurrentMethodName End EventHandler
EventHandler Sub Open() logwindow.Log CurrentMethodName End EventHandler
EventHandler Function RadioButtonClicked(ID as Integer) As boolean logwindow.Log CurrentMethodName+" ID: "+str(id) End EventHandler
EventHandler Sub Timer(Time as Integer) logwindow.Log CurrentMethodName+" Time: "+str(time) if ProgressbarState > 0 then if me.ProgressbarValue = me.ProgressbarMax then // done else me.ProgressbarValue = me.ProgressbarValue + 1 end if end if End EventHandler
EventHandler Sub VerificationClicked(Checked as Boolean) logwindow.Log CurrentMethodName+" Checked: "+str(Checked) End EventHandler
Property logWindow As MainWindow
End Class
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Win Plugin.




Links
MBS FileMaker tutorial videos