SlideShare una empresa de Scribd logo
1 de 16
in 37 minutes XMetaL Dialog Programming  Odds & Ends Murray Smith, Director of Technical Services Brought to you by XMetaL Technical Services
Announcements Next time: Derek Read will talk about  DITA Open Toolkit Deployment with XMetaL Author Enterprise 6.0
Introduction to XMetaL Dialogs Displaying your dialog from a menu button, Built-in XMetaL dialogs, Building a custom dialog, Passing objects from your macro code to the dialog, Options for where your dialog code will live. Agenda
Displaying Your Dialog From a Menu Button Step 1 The OnAction property of the menu button is associated with an XMetaL Macro. exampleMenu = Application.CommandBars.item( "Menu bar" ).Controls.Add(MENU_BUTTON_TYPE, null);  exampleMenu.Caption = 'Example 1'; var example1Menu = exampleMenu.Controls.Add(sqcbcTypePopup); example1Menu.Caption         = 'Run Example 1'; example1Menu.FaceId          = 0; example1Menu.DescriptionText = 'Display Ex. 1 Dialog.'; example1Menu.OnAction        = "ShowExample1Dialog";
Displaying Your Dialog From a Menu Button Step 2 The XMetaL macro associated with the menu button will create the dialog and display it by calling it’s DoModal() method. <MACRO name="ShowExample1Dialog" hide="true" lang="JScript"> <![CDATA[   // XMetaL Script Language JSCRIPT:   var XMetaLPath = Application.Path;   var xftPath    = XMetaLPath + "XFTExample1.xft"; var dlg=Application.CreateFormDlg( xftPath );   dlg.DoModal();   dlg=null;   ]]> </MACRO>
Built-in XMetaL Dialogs XMetaL Author supports a number of built-in dialogs. Alert: displays a message, with an ok button. Prompt: displays a message, and a text field for input. Confirm: displays a message, and ok & cancel buttons. NoticeBox: displays a message, and up to 3 buttons. MessageBox: Displays a message, a variety of buttons, and a variety of icons. Buttons: Ok, Ok/Cancel, Abort/Retry/Ignore, Yes/No, Yes/No/Cancel, Retry/Cancel. Icons: Critical, Warning Query, Warning Message, Info Message.
Built-in Dialogs – cont. The built-in dialogs are very easy to use. Example display an Alert: Application.Alert( "This is my message." ); Example display a NoticeBox: var response = Application.NoticeBox( "What is your favorite fruit?", "Apple", "Orange", "I don't like fruit." ); if( response == 1 ){   Application.Alert( "You like apples." ); } else if( response == 2 ){   Application.Alert( "You like oranges." ); } else{   Application.Alert( "You don't like fruit?" ); }
Building Custom Dialogs Custom dialogs are built in the XMetaL Form Layout Tool (XFLayout) which is part of the XMetaL Developer product.
Building Custom Dialogs – cont. After adding the dialog controls by dragging and dropping them on the form using the layout tool, you can add behavior to the controls by adding code to the desired event.
Passing Objects to Your Dialog This is simple. The script to create your dialog and display it is just slightly different from the approach we saw in example 1. var listEntries = new Array( "I don't like fruit", "Apple", "Orange", "Peach", "Pineapple" ); var returnVal   = new Object(); returnVal.response = 0; var xftPath = Application.Path + "XFTExample4.xft";       var xft = new ActiveXObject("XF.XFTForm");         xft.AddTopLevelObject( "fruitOptions", listEntries ); xft.AddTopLevelObject( "returnVal",    returnVal ); xft.AddTopLevelObject( "Application",  Application ); var dlg = xft.StartForm( xftPath, 0 ); if( dlg.DoModal() == 1 ) {    Application.Alert( "You said: " + listEntries[returnVal.response] ); } dlg         = null; xft         = null; listEntries = null;
Passing Objects to Your Dialog – cont. In the script code inside your dialog, you access the object using the name given to it when calling AddTopLevelObject(). xft.AddTopLevelObject( "fruitOptions", listEntries ); xft.AddTopLevelObject( "returnVal",    returnVal ); xft.AddTopLevelObject( "Application",  Application );
Passing Objects to Your Dialog – cont. Note: When using this approach to create your dialog, you need to explicitly pass the Application object to the dialog in order to be able to access it from your dialog code. xft.AddTopLevelObject( "Application",  Application );
Options for Where Your Dialog Code Will Live Given that we can pass JavaScript objects to the dialog, the next logical question is whether we could pass a JavaScript object that implements the dialog behavior. Event scripts in the XFT call methods on the JavaScript object
Options for Where Your Dialog Code Will Live – cont. Advantages Script code is more easily viewed. (In the XFLayout tool you can only view the code for one event macro at a time.) Since the JavaScript object is instantiated in XMetaL Author’s script engine, you have access to the script debugger in your code by adding a “debugger;” statement. Further if you pass XFT controls into those methods, you can view the property values for those controls at run time. (Whereas, if the code is all in the XFT you will need to use Alerts to be able to view the property values.)
Summary We’ve looked at some introductory topics related to dialogs in XMetaL Author. Launching a dialog from a menu item, The built-in dialogs in XMetaL Author, Creating a custom dialog. Then we built on that to look at some more advanced topics. Passing JavaScript objects to you dialog, An interesting approach to structuring your dialog script code.
Thank you for attending! Q&A

Más contenido relacionado

La actualidad más candente

Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5
sotlsoc
 

La actualidad más candente (18)

Awt components
Awt componentsAwt components
Awt components
 
Basic using of Swing in Java
Basic using of Swing in JavaBasic using of Swing in Java
Basic using of Swing in Java
 
Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5
 
Vs c# lecture3
Vs c# lecture3Vs c# lecture3
Vs c# lecture3
 
Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhana
 
Vs c# lecture1
Vs c# lecture1Vs c# lecture1
Vs c# lecture1
 
Android-dialogs in android-chapter14
Android-dialogs in android-chapter14Android-dialogs in android-chapter14
Android-dialogs in android-chapter14
 
Java awt (abstract window toolkit)
Java awt (abstract window toolkit)Java awt (abstract window toolkit)
Java awt (abstract window toolkit)
 
Android Dialogs Tutorial
Android Dialogs TutorialAndroid Dialogs Tutorial
Android Dialogs Tutorial
 
V2vdata
V2vdataV2vdata
V2vdata
 
Vs c# lecture5
Vs c# lecture5Vs c# lecture5
Vs c# lecture5
 
Javadocx j option pane
Javadocx j option paneJavadocx j option pane
Javadocx j option pane
 
Vs c# lecture2
Vs c# lecture2Vs c# lecture2
Vs c# lecture2
 
Text editors project
Text editors projectText editors project
Text editors project
 
Debugger & Profiler in NetBeans
Debugger & Profiler in NetBeansDebugger & Profiler in NetBeans
Debugger & Profiler in NetBeans
 
Web Server Controls CS Set
Web Server Controls CS Set Web Server Controls CS Set
Web Server Controls CS Set
 
The Ring programming language version 1.6 book - Part 74 of 189
The Ring programming language version 1.6 book - Part 74 of 189The Ring programming language version 1.6 book - Part 74 of 189
The Ring programming language version 1.6 book - Part 74 of 189
 
Balance de ingresos y egresos diarios de una persona
Balance de ingresos y egresos diarios de una personaBalance de ingresos y egresos diarios de una persona
Balance de ingresos y egresos diarios de una persona
 

Similar a XMetaL Dialog Odds & Ends

Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
Aarti P
 
Gui builder
Gui builderGui builder
Gui builder
learnt
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
pbarasia
 
Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculator
Vlad Kolesnyk
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptAdvisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScript
dominion
 
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
paynetawnya
 
Create yourfirstandroidapppdf
Create yourfirstandroidapppdfCreate yourfirstandroidapppdf
Create yourfirstandroidapppdf
murad3003
 
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docxLabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
DIPESH30
 

Similar a XMetaL Dialog Odds & Ends (20)

Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
ArduinoWorkshop2.pdf
ArduinoWorkshop2.pdfArduinoWorkshop2.pdf
ArduinoWorkshop2.pdf
 
Gui builder
Gui builderGui builder
Gui builder
 
Ingles 2do parcial
Ingles   2do parcialIngles   2do parcial
Ingles 2do parcial
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
 
Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculator
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptAdvisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScript
 
Introduction To Programming
Introduction To ProgrammingIntroduction To Programming
Introduction To Programming
 
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
 
GUI (graphical user interface)
GUI (graphical user interface)GUI (graphical user interface)
GUI (graphical user interface)
 
Create yourfirstandroidapppdf
Create yourfirstandroidapppdfCreate yourfirstandroidapppdf
Create yourfirstandroidapppdf
 
TVML apps on the Apple TV
TVML apps on the Apple TVTVML apps on the Apple TV
TVML apps on the Apple TV
 
Using prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile servicesUsing prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile services
 
Testing Options in Java
Testing Options in JavaTesting Options in Java
Testing Options in Java
 
Introduction To Programming (2009 2010)
Introduction To Programming (2009 2010)Introduction To Programming (2009 2010)
Introduction To Programming (2009 2010)
 
Introduction to programming by MUFIX Commnity
Introduction to programming by MUFIX CommnityIntroduction to programming by MUFIX Commnity
Introduction to programming by MUFIX Commnity
 
Software fundamentals
Software fundamentalsSoftware fundamentals
Software fundamentals
 
Deck 6-456 (1)
Deck 6-456 (1)Deck 6-456 (1)
Deck 6-456 (1)
 
Mastering python lesson2
Mastering python lesson2Mastering python lesson2
Mastering python lesson2
 
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docxLabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
 

Más de XMetaL

Fine-tuning the DITA customization
Fine-tuning the DITA customizationFine-tuning the DITA customization
Fine-tuning the DITA customization
XMetaL
 
Displaying additional image types in XMetaL
Displaying additional image types in XMetaLDisplaying additional image types in XMetaL
Displaying additional image types in XMetaL
XMetaL
 
Deploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization FilesDeploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization Files
XMetaL
 
DITA Open Toolkit Deployment with XMetaL Author Enterprise 6
DITA Open Toolkit Deployment with XMetaL Author Enterprise 6DITA Open Toolkit Deployment with XMetaL Author Enterprise 6
DITA Open Toolkit Deployment with XMetaL Author Enterprise 6
XMetaL
 

Más de XMetaL (11)

65 New Highlights of XMetaL Author Enterprise 7.0
65 New Highlights of XMetaL Author Enterprise 7.065 New Highlights of XMetaL Author Enterprise 7.0
65 New Highlights of XMetaL Author Enterprise 7.0
 
Fine-tuning the DITA customization
Fine-tuning the DITA customizationFine-tuning the DITA customization
Fine-tuning the DITA customization
 
Displaying additional image types in XMetaL
Displaying additional image types in XMetaLDisplaying additional image types in XMetaL
Displaying additional image types in XMetaL
 
Dropping content isn't a drag!
Dropping content isn't a drag!Dropping content isn't a drag!
Dropping content isn't a drag!
 
Quick and Easy Usability in XMetaL Author
Quick and Easy Usability in XMetaL AuthorQuick and Easy Usability in XMetaL Author
Quick and Easy Usability in XMetaL Author
 
Putting DITA Localization into Practice
Putting DITA Localization into PracticePutting DITA Localization into Practice
Putting DITA Localization into Practice
 
XMetaL Macros for Non-Programmers
XMetaL Macros for Non-ProgrammersXMetaL Macros for Non-Programmers
XMetaL Macros for Non-Programmers
 
Deploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization FilesDeploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization Files
 
DITA Open Toolkit Deployment with XMetaL Author Enterprise 6
DITA Open Toolkit Deployment with XMetaL Author Enterprise 6DITA Open Toolkit Deployment with XMetaL Author Enterprise 6
DITA Open Toolkit Deployment with XMetaL Author Enterprise 6
 
Taking Advantage of XMetaL’s XInclude Support
Taking Advantage of XMetaL’s XInclude SupportTaking Advantage of XMetaL’s XInclude Support
Taking Advantage of XMetaL’s XInclude Support
 
XMetaL and DITA in the Marketing Department: Tastes Great, Less Filling
XMetaL and DITA in the Marketing Department: Tastes Great, Less FillingXMetaL and DITA in the Marketing Department: Tastes Great, Less Filling
XMetaL and DITA in the Marketing Department: Tastes Great, Less Filling
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 

XMetaL Dialog Odds & Ends

  • 1. in 37 minutes XMetaL Dialog Programming Odds & Ends Murray Smith, Director of Technical Services Brought to you by XMetaL Technical Services
  • 2. Announcements Next time: Derek Read will talk about DITA Open Toolkit Deployment with XMetaL Author Enterprise 6.0
  • 3. Introduction to XMetaL Dialogs Displaying your dialog from a menu button, Built-in XMetaL dialogs, Building a custom dialog, Passing objects from your macro code to the dialog, Options for where your dialog code will live. Agenda
  • 4. Displaying Your Dialog From a Menu Button Step 1 The OnAction property of the menu button is associated with an XMetaL Macro. exampleMenu = Application.CommandBars.item( "Menu bar" ).Controls.Add(MENU_BUTTON_TYPE, null); exampleMenu.Caption = 'Example 1'; var example1Menu = exampleMenu.Controls.Add(sqcbcTypePopup); example1Menu.Caption = 'Run Example 1'; example1Menu.FaceId = 0; example1Menu.DescriptionText = 'Display Ex. 1 Dialog.'; example1Menu.OnAction = "ShowExample1Dialog";
  • 5. Displaying Your Dialog From a Menu Button Step 2 The XMetaL macro associated with the menu button will create the dialog and display it by calling it’s DoModal() method. <MACRO name="ShowExample1Dialog" hide="true" lang="JScript"> <![CDATA[ // XMetaL Script Language JSCRIPT: var XMetaLPath = Application.Path; var xftPath = XMetaLPath + "XFTExample1.xft"; var dlg=Application.CreateFormDlg( xftPath ); dlg.DoModal(); dlg=null; ]]> </MACRO>
  • 6. Built-in XMetaL Dialogs XMetaL Author supports a number of built-in dialogs. Alert: displays a message, with an ok button. Prompt: displays a message, and a text field for input. Confirm: displays a message, and ok & cancel buttons. NoticeBox: displays a message, and up to 3 buttons. MessageBox: Displays a message, a variety of buttons, and a variety of icons. Buttons: Ok, Ok/Cancel, Abort/Retry/Ignore, Yes/No, Yes/No/Cancel, Retry/Cancel. Icons: Critical, Warning Query, Warning Message, Info Message.
  • 7. Built-in Dialogs – cont. The built-in dialogs are very easy to use. Example display an Alert: Application.Alert( "This is my message." ); Example display a NoticeBox: var response = Application.NoticeBox( "What is your favorite fruit?", "Apple", "Orange", "I don't like fruit." ); if( response == 1 ){ Application.Alert( "You like apples." ); } else if( response == 2 ){ Application.Alert( "You like oranges." ); } else{ Application.Alert( "You don't like fruit?" ); }
  • 8. Building Custom Dialogs Custom dialogs are built in the XMetaL Form Layout Tool (XFLayout) which is part of the XMetaL Developer product.
  • 9. Building Custom Dialogs – cont. After adding the dialog controls by dragging and dropping them on the form using the layout tool, you can add behavior to the controls by adding code to the desired event.
  • 10. Passing Objects to Your Dialog This is simple. The script to create your dialog and display it is just slightly different from the approach we saw in example 1. var listEntries = new Array( "I don't like fruit", "Apple", "Orange", "Peach", "Pineapple" ); var returnVal = new Object(); returnVal.response = 0; var xftPath = Application.Path + "XFTExample4.xft"; var xft = new ActiveXObject("XF.XFTForm"); xft.AddTopLevelObject( "fruitOptions", listEntries ); xft.AddTopLevelObject( "returnVal", returnVal ); xft.AddTopLevelObject( "Application", Application ); var dlg = xft.StartForm( xftPath, 0 ); if( dlg.DoModal() == 1 ) { Application.Alert( "You said: " + listEntries[returnVal.response] ); } dlg = null; xft = null; listEntries = null;
  • 11. Passing Objects to Your Dialog – cont. In the script code inside your dialog, you access the object using the name given to it when calling AddTopLevelObject(). xft.AddTopLevelObject( "fruitOptions", listEntries ); xft.AddTopLevelObject( "returnVal", returnVal ); xft.AddTopLevelObject( "Application", Application );
  • 12. Passing Objects to Your Dialog – cont. Note: When using this approach to create your dialog, you need to explicitly pass the Application object to the dialog in order to be able to access it from your dialog code. xft.AddTopLevelObject( "Application", Application );
  • 13. Options for Where Your Dialog Code Will Live Given that we can pass JavaScript objects to the dialog, the next logical question is whether we could pass a JavaScript object that implements the dialog behavior. Event scripts in the XFT call methods on the JavaScript object
  • 14. Options for Where Your Dialog Code Will Live – cont. Advantages Script code is more easily viewed. (In the XFLayout tool you can only view the code for one event macro at a time.) Since the JavaScript object is instantiated in XMetaL Author’s script engine, you have access to the script debugger in your code by adding a “debugger;” statement. Further if you pass XFT controls into those methods, you can view the property values for those controls at run time. (Whereas, if the code is all in the XFT you will need to use Alerts to be able to view the property values.)
  • 15. Summary We’ve looked at some introductory topics related to dialogs in XMetaL Author. Launching a dialog from a menu item, The built-in dialogs in XMetaL Author, Creating a custom dialog. Then we built on that to look at some more advanced topics. Passing JavaScript objects to you dialog, An interesting approach to structuring your dialog script code.
  • 16. Thank you for attending! Q&A