PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
DoCreate = .T.
Caption = "Form1"
*-- XML Metadata for customizable properties
_memberdata = ""
Name = "Form1"
ADD OBJECT taskdialogmarkup AS olecontrol WITH ;
Top = 12, ;
Left = 12, ;
Height = 28, ;
Width = 16, ;
oleClass = "Codejock.TaskDialog.15.3.1",;
Name = "taskDialogMarkup"
ADD OBJECT command1 AS commandbutton WITH ;
Top = 72, ;
Left = 24, ;
Height = 96, ;
Width = 312, ;
FontSize = 12, ;
Caption = "\<Show TaskDialog", ;
Name = "Command1"
ADD OBJECT taskdialog AS olecontrol WITH ;
Top = 12, ;
Left = 36, ;
Height = 100, ;
Width = 100, ;
oleClass = "Codejock.TaskDialog.15.3.1",;
Name = "taskDialog"
PROCEDURE loaddialogs
Local gnFileHandle,nSize,cString
gnFileHandle = FOPEN("C:\Dialogs.xml")
* Seek to end of file to determine number of bytes in the file.
nSize = FSEEK(gnFileHandle, 0, 2) && Move pointer to EOF
IF nSize <= 0
* If file is empty, display an error message.
WAIT WINDOW "This file is empty!" NOWAIT
ELSE
* If file is not empty, store the file's contents in memory
* and display the text in the main Visual FoxPro window.
= FSEEK(gnFileHandle, 0, 0) && Move pointer to BOF
cString = FREAD(gnFileHandle, nSize)
ENDIF
= FCLOSE(gnFileHandle) && Close the file
RETURN cString
ENDPROC
PROCEDURE command1.Click
Thisform.TaskDialog.Reset()
Thisform.TaskDialog.CommonButtons = 0
Thisform.TaskDialog.CreateFromXML(thisform.LoadDialogs(),"Dialogs/Dialog[@Name='Dialog002']")
MESSAGEBOX(Thisform.TaskDialog.ShowDialog())
ENDPROC
ENDDEFINE
*
*-- EndDefine: form1
**************************************************
* Dialogs.xml
*<?xml version="1.0" encoding="UTF-8"?>
*<Dialogs xmlns="[URL unfurl="true"]http://www.codejock.com/schema/TDSchema.xsd">[/URL]
* <Dialog AllowCancel="false" Name="Dialog002">
* <WindowTitle>MyTitle</WindowTitle>
* <MainInstruction Image="*Information">My SubTitle</MainInstruction>
* <Content>¿Here's the Question or Message Content?</Content>
* <Buttons Default="1">
* <CommandLink Shield="true" ID="1">
* <Text>Yes Or Accept</Text>
* <Explanation>Button 1 Hint</Explanation>
* </CommandLink>
* <CommandLink ID="2">
* <Text>No or Cancel</Text>
* <Explanation>Button 2 Hint.</Explanation>
* </CommandLink>
* </Buttons>
* </Dialog>
*</Dialogs>
**************************************************