Skip to content
Demo of the DataView and DataView Helper Levure helpers
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Update dataview submodule pointer Mar 31, 2019
levure @ d3f00c2 Update Levure submodule pointer Feb 24, 2019
.gitignore Ignore sublime workspace files Jan 2, 2019
.gitmodules Add file_browser submodule Jan 18, 2019
DataView Demo.sublime-project Show levure folder in project Jan 1, 2019
LICENSE Update license year Jan 1, 2019
README.md Updated README Jan 18, 2019

README.md

DataView Demo Levure Project

This repo contains a Levure application which demonstrates how to use the DataView and DataView Tree helpers. If you are checking this repo out with git on your local computer make sure you initialize submodules. Levure, DataView helper, DataView Tree helper, and DataView Database Cursor helper are all submodules.

To open the application, launch LiveCode and open the ./app/standalone.livecode stack file, switch to the Browse tool, and click on the Open Application button.

Screencast walkthrough: https://youtu.be/euIHj1Qrokk

Levure: https://github.com/trevordevore/levure

DataView helper: https://github.com/trevordevore/levurehelper-dataview

DataView Tree helper: https://github.com/trevordevore/levurehelper-dataview-tree

DataView Database Cursor helper: https://github.com/trevordevore/levurehelper-database_dbcursor

File Browser helper: https://github.com/trevordevore/levurehelper-file_browser

Requirements: Tested with LiveCode 9.

DataView Example

The DataView example displays all of the extensions installed in the LiveCode IDE as returned by the function revIDEExtensions(). Each row lists the extension name, version, and author. Double-clicking on a row will reveal the folder where the extension is installed.

The behavior of the DataView group is set to stack "DataView Array Controller Behavior". This is the default controller that comes with the DataView helper. The behavior scripts adds a dvData property (among many others) that is set to a numerically indexed array of row data arrays. This array is fed to the DataView.

You will find the row template used in the DataView in the ./app/templates/dataview templates folder.

File Browser: DataView Tree Example

The File Browser helper is a helper built on top of the DataView Tree. It creates a tree UI based on a folder you select on your computer. The UI allows you to expand the contents of any folders listed. Double-clicking on a file or folder will open it.

You can right-click on a file or folder and rename it using the contextual menu. The file/folder will not actually be renamed but an answer dialog will appear showing you what the new name would be.

Stack Browser: DataView Tree Example

The stack browser example is built on top of the DataView Tree. It creates a tree UI for browsing the open stacks in the IDE. The behavior of the DataView group is set to stack "DataView Tree Behavior", the behavior that comes with the helper. The behavior scripts adds a dvTree property (among many others) that is set to a numerically indexed array of node arrays.

You will find the row templates used in the DataView in the ./app/templates/dataview controls templates folder.

FontAwesome: DataView Database Cursor Example

The FontAwesome tab is an example that uses the dataview_dbcursor helper to display a database cursor that has been opened using revQueryDatabase(). The database contains the name of drawing representations (see drawingSvgCompile() in the LiveCode docs) of the FontAwesome icons.

The behavior of the DataView group is set to stack "DataView Database Cursor Controller Behavior", the behavior that comes with the helper. The behavior script adds a dvCursor property that you can set to the cursor id returned by revQueryDatabase(). When scrolling through the DataView or setting properties such as the dvSelectedId the behavior will navigate the cursor and fetch the appropriate data.

You will find the row template used in the DataView in the ./app/templates/dataview db cursor templates folder.

Importing SVG files into the database

For reference, the following script was used to import the FontAwesome SVG files into the fontawesome.db included with this demo.

command ImportSVGs
  put levureAppFolder() & "/database/fontawesome.db" into tDbFile
  
  answer folder "Images"
  put it into tImageFolder
  
  put revOpenDatabase("sqlite", tDbFile) into tConnId
  
  put files(tImageFolder) into tFiles
  filter tFiles without ".*"
  
  set the itemDelimiter to "."
  repeat for each line tFile in tFiles
    put drawingSvgCompile(url("file:" & tImageFolder & "/" & tFile)) into tBinarySVG
    put item 1 of tFile into tName
    
    revExecuteSQL tConnId, "INSERT INTO icons (name, compiled_svg)" && \
        "VALUES(:1, :2)", "tName", "*btBinarySVG"
    if the result is not an integer then
      beep
      put the result
      exit repeat
    end if
  end repeat
  
  revCloseDatabase tConnId
end ImportSVGs

Movies: DataView Database Cursor Example

The Movies tab also uses the dataview_dbcursor helper.

You will find the row template used in the DataView in the ./app/templates/dataview movies templates folder.

You can’t perform that action at this time.