Writing Explorer in EZY Prolog By Serguei Penkov © 2002 EDMGROUP Australia.

Slides:



Advertisements
Similar presentations
Chapter 3 – Web Design Tables & Page Layout
Advertisements

Objectives Build and modify an organization chart.
CREATING A MULTIPLE PAGE REPORT Presented by: Dr. Ennis-Cole.
Word Processing First Steps
Chapter 10—Creating Presentations
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
Customizing Outlook. Forms Window in which you enter and view information in Outlook Outlook Form Designer The environment in which you create and customize.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
3.2 Presentation Software End Show Creating slide shows including audio,video and digital images End Show.
Customizing Forms and Writing QuickBooks Letters Lesson 15.
With Alex Conger – President of Webmajik.com FrontPage 2002 Level I (Intro & Training) FrontPage 2002 Level I (Intro & Training)
Review of last session The Weebly Dashboard The Weebly Dashboard Controls your account and your sites Controls your account and your sites From here you.
Chapter 3 Introduction to Event Handling and Windows Forms Applications.
Microsoft Visual Basic 2012 CHAPTER TWO Program and Graphical User Interface Design.
XP Tutorial 7 New Perspectives on Microsoft Windows XP 1 Microsoft Windows XP Working with Graphics Tutorial 7.
Customizing forms and writing QuickBooks Letters Lesson 15.
Lesson 1 – Microsoft Excel The goal of this lesson is for students to successfully explore and describe the Excel window and to create a new worksheet.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
HTML, Third Edition--Illustrated Introductory 1 HTML, Third Edition Illustrated Introductory Unit F Working with Tables.
Chapter 3 Dreamweaver: Part I The Web Warrior Guide to Web Design Technologies.
Word Processing ADE100- Computer Literacy Lecture 12.
Web Technologies Website Development Trade & Industrial Education
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Website Development with Dreamweaver
ArcGIS: ArcMap Layout View. Agenda Layout interface Using templates Page properties Data frame properties Toolbars Layout elements Fine-tuning Finishing.
XP Tutorial 1 Introduction to Macromedia Flash MX 2004.
1 The EDIT Program The Edit program is a full screen text editor that allows you to: Create text files Create text files Edit an existing text files Edit.
XP New Perspectives on Microsoft Word 2002 Tutorial 31 Microsoft Word 2002 Tutorial 3 – Creating a Multiple-Page Report.
ATN GIS Support ArcGIS: ArcMap Layout View.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 14 Tables.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 1 1 Microsoft Office FrontPage 2003 Tutorial 1 – Creating a Web Site.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 3 Welcome Application Introduction to Visual Programming.
Learning With Computers I (Level Green) ©2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly.
4 Chapter Four Introduction to HTML. 4 Chapter Objectives Learn basic HTML commands Discover how to display graphic image objects in Web pages Create.
Chapter 2 – Introduction to the Visual Studio .NET IDE
Introduction to Matlab & Data Analysis 2015 In this tutorial we will: Build a practical application using GUIDE Learn more about graphical user interface.
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
Slide 1 ACS Foundation Software Update Version 1.80.
Presented By: Weidong WU, Ph.D. Date: Part I Creating a drawing format for the paper size A (11 x 8.5) 1. Start Pro/E wildfire. 2. File  set.
Page Designer Storyboard J. A. Fitzpatrick December 2004.
Microsoft Visual Basic 2010 CHAPTER TWO Program and Graphical User Interface Design.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
HTML Basics. HTML Coding HTML Hypertext markup language The code used to create web pages.
Key Applications Module Lesson 14 — Working with Tables Computer Literacy BASICS.
Introducing Dreamweaver. Dreamweaver The web development application used to create web pages Part of the Adobe creative suite.
Microsoft FrontPage 2003 Illustrated Complete Working on the Web Site’s Hyperlinks and Appearance.
Web Site Development - Process of planning and creating a website.
XP Tutorial 3 Creating Animations. XP New Perspectives on Macromedia Flash MX Elements of Animation Layers are used to organize the content of.
Web and Multimedia Development Copyright © Genetic Computer School 2007WM LESSON OVERVIEW  Use of Tables  Creating Tables  Try It – 1  Creating.
Open Office Writer Introduction AOSS _ Course material AOSS Master training workshop Singapore 2007.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
>>0 >>1 >> 2 >> 3 >> 4 >>
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
© Execview Ltd 2015: all rights reserved Execview Scorecard Training/Reference Guide 2013 Key functions guide for Scorecard administrators.
MS WORD INFORMATION TECHNOLOGY MANAGEMENT SERVICE Training & Research Division.
1 Word Processing Intermediate Using Microsoft Office 2000.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Creating a Navigation Bar.
Lesson 13 Tables. Overview Create a table. Key and edit text in tables. Select cells, rows, and columns. Edit table structures. Format tables and cell.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 5 1 Microsoft Office FrontPage 2003 Tutorial 5 – Creating Tables and Frames.
With Microsoft FrontPage 2000
An Introduction to Computers and Visual Basic
Planning and Building a Presentation
Program and Graphical User Interface Design
An Introduction to Computers and Visual Basic
Chapter 2 – Introduction to the Visual Studio .NET IDE
An Introduction to Computers and Visual Basic
Chapter 4 Enhancing the Graphical User Interface
Presentation transcript:

Writing Explorer in EZY Prolog By Serguei Penkov © 2002 EDMGROUP Australia

“Hello world” Every programming language tutorial starts with "Hello World" sample. But once you pass this stage and confident that it is possible, you will start looking into ways how you can write something useful. It is hard to imagine modern program without rich user interface and modern version of "Hello world" should include graphical user interface. I think that various Explorers (or Explorer-style applications) could represent modern version of "Hello world". This tutorial displays step-by-step how to write complex application such as File Explorer using EZY Prolog. Click mouse to continue

Explorer-style application Explorer-style application usually consist of 3 major areas: Top Level frame Left Frame with tree view Right Frame with grid and editor

Explorer-style application Vertical Splitbar between frames Press here to create Vetrical Splitbar Left and Right frames now separated by vertical bar Click inside Explorer Frame to select

Setting colours Text colour Background Colour Border Colour Border Width

Setting auto-alignment Left frame – auto aligned to parent bottom. Right Frame – to parent right bottom Align to Parent Right Bottom Align to Parent Bottom Align to Parent Right Bottom

Generate code frame One button click code generation Press Generate button Prolog Code generated. Note: GUI declarations loaded from DCL file. Program code is separated from GUI declarations. Preview GUI: Note auto-alignment, vertical split bar

Adding Treeview element Add Treeview Draw rectangle inside Left Frame. Left Top Corner Draw rectangle inside Left Frame. Bottom Right Corner

Treeview colour and alignment Set Treeview auto-align to Left frame right bottom Select treeview Align to parent Right Bottom Define Background Colour

Group properties settings Set properties for selected controls Click inside control to select Set Background Color

Deselecting controls Click right mouse button to display popup menu Deselect all

Treeview properties Setting colour for back and fore ground Select treeview and click right button Select Properties Change Foreground colour

Setting Treeview font Change Font settings

Set Treeview auto-alignment Auto align treeview to the Left Frame right bottom Preview results Set alignment: Parent right bottom Select treeview control

Set Treeview initial Tree Click on Tree property Tree Editor will appear. Use popup menu for tree editing Click inside Treeview to select

Preview results Create EZY Prolog application to display designed GUI Auto aligned to parent bottom: Explorer Frame Auto aligned to parent Right bottom: Explorer Frame Auto aligned to parent Right bottom: Left Frame Slidebar: Supports auto align properties

Treeview support code EZY Prolog generates necessary initialization and callback codes GUI declarations loaded from file on program start Generated code for treeview initialization and callback Treeview callback template automatically generated Treeview callback in action: Write to message window on user action: Open/Close of the node Double click on node

Adding Grid control Align grid to Right Frame right border Draw rectangle inside Right Frame Set alignment: Parent right bottom

Grid control – setting colours Easy way to define colours for grid control: headers,back/fore ground… Set title colors Set title colours Preview results

Grid control – define headers Type in headers separated by colon Define grid headers

Final GUI element - editor Adding Editor to edit text files Draw rectangle inside Right Frame

Explorer-style application Create Horizontal Splitbar between Grid and Editor Click inside Right Frame Create Horizontal Splitbar Select Editor Align to parent right bottom Preview results

GUI at run-time. Treeview is auto-aligned to Left Frame right bottom, Grid and Editor are separated by horizontal splitbar Move splitbarSelect Row Open/Close nodes Double click on node

Generated code template EZY Prolog Designer generates code frame for GUI initialization and callbacks. Code template are ready to use Treeview callbackGrid callback

Adding Functionality Treeview – explore file system. Display Folders in Treeview and list of files in the GRID GRID – show selected file in editor EDITOR – default functionality

Treeview – initialize tree The following code sets initial tree initialize_explorer_tree( WINDOW ):- EXPLORER_TREE_ADDR =[ "Explorer Frame", "Left Frame", "explorer_tree" ], ezy_get_object ezy_get_object ( WINDOW, EXPLORER_TREE_ADDR, EXPLORER_TREE_WINDOW ), ezy_treeview_callback ezy_treeview_callback ( EXPLORER_TREE_WINDOW, treeview_explorer_tree_handler ), syspath ( PATH, _ ), /* USER CODE – INITIALIZE TREEVIEW */ string_to_slist ( PATH, "\\", DIRECTORIES ), create_directory_tree( PATH, DIRECTORIES, TREEVIEW ), ezy_treeview_item ezy_treeview_item ( EXPLORER_TREE_WINDOW,[], TREEVIEW ), write ( " *** {explorer_tree} Initialized\n" ),!. /* USER CODE – CONVERT PATH INTO TREEVIEW */ create_directory_tree( PATH,[ DIR, _ ], TREEVIEW ):-!, directories ( PATH, DIRLIST ), dirlist_to_treelist( DIRLIST, TREELIST ), ezy_treeview_icon ezy_treeview_icon ( "book_opened", OPENED_ICON ), TREEVIEW =bi( 0, DIR,node( open, TREELIST ), OPENED_ICON ). create_directory_tree( PATH,[ DIR |DIRLIST], TREEVIEW ):-!, create_directory_tree( PATH, DIRLIST, TREEVIEW_CHILD ), ezy_treeview_icon ezy_treeview_icon ( "book_opened", OPENED_ICON ), TREEVIEW =bi( 0, DIR,node( open,[ TREEVIEW_CHILD ]), OPENED_ICON ). /* USER CODE – CONVERT LIST OF DIRECTORIES INTO TREELIST */ dirlist_to_treelist([],[]):-!. dirlist_to_treelist([ DIR |DIRLIST], TREELIST ):- DIR = ".",!, dirlist_to_treelist( DIRLIST, TREELIST ). dirlist_to_treelist([ DIR |DIRLIST], TREELIST ):- DIR = "..",!, dirlist_to_treelist( DIRLIST, TREELIST ). dirlist_to_treelist([ DIR |DIRLIST],[ ITEM |TREELIST]):- ezy_treeview_icon ezy_treeview_icon ( "book_opened", OPENED_ICON ), ITEM =bi( 0, DIR, leaf, OPENED_ICON ), dirlist_to_treelist( DIRLIST, TREELIST ).

Treeview – writing callback Display list of directories and files /* ON DOUBLE CLICK INISDE TREEVIEW – RUN TREE CLICK PROCESSOR */ treeview_explorer_tree_handler( WINDOW,mouse_dbl( _, _, _ )):-explorer_process_tree_click( WINDOW ),!. explorer_process_tree_click( WINDOW ):- get_selected_path( WINDOW, SELECTED_PATH_SLASH ), explorer_display_directories( WINDOW, SELECTED_PATH_SLASH ), SELECTION_LIST =[ "*.pro", "*.dcl" ], files ( SELECTED_PATH_SLASH, SELECTION_LIST, FILELIST ), ezy_get_parent ezy_get_parent ( WINDOW, "Explorer Frame", FIRST_WINDOW ), explorer_display_filelist( FIRST_WINDOW, FILELIST, SELECTED_PATH_SLASH ), !. explorer_display_filelist( FIRST_WINDOW, FILELIST, SELECTED_PATH_SLASH ):- GRID_ADDRESS =[ "Explorer Frame", "Right Frame", "results" ], ezy_get_object ezy_get_object ( FIRST_WINDOW, GRID_ADDRESS, GRID_WINDOW ), ezy_grid_clear ezy_grid_clear ( GRID_WINDOW ), slist_length ( FILELIST, MAXROW ), ezy_grid_rows ezy_grid_rows ( GRID_WINDOW, MAXROW ), explorer_fill_grid( GRID_WINDOW, 1, FILELIST, SELECTED_PATH_SLASH ), !. Define what to do when user double clicks in TREEVIEW Process double click Get selected PATH from the tree elements Display list of directories for selected node Get list of FILES for selected Directory Display list of files in the GRID

Treeview – get current path Read current selection in treeview Convert it into PATH, display PATH get_selected_path( WINDOW, SELECTED_PATH_SLASH ):- ezy_treeview_address ezy_treeview_address ( WINDOW, PARENTS, _ ), slist_to_string ( PARENTS, "\\", SELECTED_PATH ), concat ( SELECTED_PATH, "\\", SELECTED_PATH_SLASH ), ezy_get_parent ezy_get_parent ( WINDOW, "Explorer Frame", FIRST_WINDOW ), PATH_ADDRESS =[ "Explorer Frame", "Right Frame" ], ezy_get_object ezy_get_object ( FIRST_WINDOW, PATH_ADDRESS, PATH_WINDOW ), VPS_TEXT =vps_text( SELECTED_PATH_SLASH,[]), ezy_frame_caption ezy_frame_caption ( PATH_WINDOW, VPS_TEXT ), !. Get list of SELECTED NODE PARENTS Convert SLIST to PATH with slash at the end Get ADDRESS of the RIGHT FRAME To display selected PATH Display PATH List = [“c:”,”vpstudio”,”vp_studio_dcl”,”exe”]

Treeview – writing callback Display list of files in the grid /* SAMPLE CODE TO DISPLAY FILELIST IN THE GRID */ files ( SELECTED_PATH_SLASH, SELECTION_LIST, FILELIST ), ezy_get_parent ezy_get_parent ( WINDOW, "Explorer Frame", FIRST_WINDOW ), explorer_display_filelist( FIRST_WINDOW, FILELIST, SELECTED_PATH_SLASH ), explorer_fill_grid( _, _,[], _ ):-!. explorer_fill_grid( GRID_WINDOW, ROW,[ FILENAME |FILELIST], PATH ):-!, filenameext ( FILENAME, NAME, EXT ), format ( FULLFILENAME, "%s%s", PATH, FILENAME ), filedetails ( FULLFILENAME, _, H, M, _, Y, MM, D, FSize ), dt_min_to_offset ( Y, M, D, H, MM, DATE_OFFSET ), dt_minoffset_to_str ( DATE_OFFSET, "%YL-%MD-%DD %HH:%MM", DATE_STAMP ), format ( FILESIZE, "%", FSize ), ezy_grid_cell ezy_grid_cell ( GRID_WINDOW, ROW, 1, NAME ), ezy_grid_cell ezy_grid_cell ( GRID_WINDOW, ROW, 2, EXT ), ezy_grid_cell ezy_grid_cell ( GRID_WINDOW, ROW, 3, DATE_STAMP ), ezy_grid_cell ezy_grid_cell ( GRID_WINDOW, ROW, 4, FILESIZE ), NEXTROW = ROW + 1, explorer_fill_grid( GRID_WINDOW, NEXTROW, FILELIST, PATH ). Get list of FILES Display in the GRID Get File details: Date stamp, Size Fill file properties into the GRID Continue with next ROW Stop when list of files is EMPTY ([])

GRID callback Display selected text file in Editor grid_results_handler( GRID_WINDOW,user_action(grid_marker(grid_row_marker([gl( ROW, ROW )]), 1 ))):- explorer_grid_click( GRID_WINDOW, ROW ), !. explorer_grid_click( GRID_WINDOW, ROW ):- ezy_get_parent ezy_get_parent ( GRID_WINDOW, "Explorer Frame", FIRST_WINDOW ), PATH_ADDRESS =[ "Explorer Frame", "Right Frame" ], ezy_get_object ezy_get_object ( FIRST_WINDOW, PATH_ADDRESS, PATH_WINDOW ), ezy_frame_caption ezy_frame_caption ( PATH_WINDOW, VPS_TEXT ), VPS_TEXT =vps_text( SELECTED_PATH, _ ), ezy_grid_cell ezy_grid_cell ( GRID_WINDOW, ROW, 1, FILENAME ), ezy_grid_cell ezy_grid_cell ( GRID_WINDOW, ROW, 2, FILETYPE ), format ( FULLNAME, "%s%s.%s", SELECTED_PATH, FILENAME, FILETYPE ), write ( "explorer_grid_callback selected ROW=", ROW, " FILE: ", FULLNAME, "\n" ), file_str ( FULLNAME, FILE_DATA ), TEXT_EDITOR_ADDRESS =[ "Explorer Frame", "Right Frame", "editor" ], ezy_get_object ezy_get_object ( FIRST_WINDOW, TEXT_EDITOR_ADDRESS, EDITOR_WINDOW ), ezy_editor_string ezy_editor_string ( EDITOR_WINDOW, FILE_DATA ), !. GRID handler receives control Get address of the top GUI element Get address of the frame with PATH Get value of the selected PATH Get value of the selected FILE. Create full File Name Get FILE content Get address of EDITOR and display file content GRID row selected

Userfull tips: Getting address of the GUI element Select control in EZY Designer tree Click right mouse button Select – Control Address to Clipboard ADDR = ["Explorer Frame","Right Frame","editor"] Paste address into EZY Prolog program

Thank you for your time. More samples on: © 2002 EDMGROUP Australia