Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: Next thinBasic: template dialog

  1. #11
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Petr,

    your code is working as T90 Tank

    I think that we need to add a CDATA inside <code>...</code> in order to avoid character misinterpretation:

    My code is not able to interpret CDATA and it just hangs
    Your code seems just ignoring and returned source code is the code plus CDATA so your code is much better.

    I will see what I can do.
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #12
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    I forgot I have a MSXML wrapper: #INCLUDE "%APP_INCLUDEPATH%\TB_XML60.INC"

    Will see what I can get from it.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #13
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404
    I like the layout Eros. About section 3, how about keeping the data in a SQL database on the server. This way there are no xml files to distribute and information is up to date all the time. In fact, the templates themselves could come from the server. So only templates people need are downloaded and your distribution file remains small.

  4. #14
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Thanks Kent

    Maybe on a second step I will add server side templates but at first they will be distributed with setup. They are just text files so the space they occupy on a compressed distribution is just minimum.

    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #15
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    The CDATA note is important. I think even my T90 routines would have problem in case the text between <Code></Code> would contain </Code> for example in string.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #16
    1)
    Template file format
    I would move the template file format completely to XML, having the following structure:
    petr, does this mean your are only taking this xml for header import? Not for whole dialog code example content I am not sure what's your intention, better to ask here for it. the dialog code example content doesn't need this xml text format? if that's the case ist true I can't read nor more this code format with adding colors and styles formats or java script enhancements in xml text

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <verzeichnis>
         <titel>Wikipedia Städteverzeichnis</titel>
         <eintrag>
              <stichwort>Genf</stichwort>
              <eintragstext>Genf ist der Sitz von ...</eintragstext>
         </eintrag>
         <eintrag>
              <stichwort>Köln</stichwort>
              <eintragstext>Köln ist eine Stadt, die ...</eintragstext>
         </eintrag>
    </verzeichnis>
    
    2) a dialog should have a

    a) simple list/combobox for thinbasic *tmplate too
    b) and I like to add the color of a dialog window parameters with simple adding at the end two commands ( rgb(100,0,200), rgb(255,160,255) or/and "gradient style" ) of dialog parameter
    c) dialog with menu (and perhaps toolbar)

    I shall write that for you?

    I generally like the idea for new dialog format/template.

    bye, largo
    Last edited by largo_winch; 24-01-2012 at 15:36.

  7. #17
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Largo,

    just to be sure ...
    we are talking about improving thinAir/File/New dialog
    and improving the <template> file structure transforming it from plain text to xml code for better handling and future enhancements

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  8. #18
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Below code is parsing XML thinAir template idea of Petr using thinBasic native XML wrapper.
    I think I will go this way for thinAir parser.

    Attached thinBasic source and template

    Code
    Uses "Console"
    
    
    #INCLUDE "%APP_INCLUDEPATH%\TB_XML60.INC"
    
    
    $XMLFile = APP_SourcePath+"_Template_.xml"
      
    Function TBMain()
      
      Local pXmlDoc         As DWord
      Local pRoot           As DWord
      Local pRootName       As String
      Local pRootVersion    As Variant
      Local pRootType       As Variant
      
      Local pHeader         As DWord
      Local pFiles          As DWord
      Local pFile           As DWord
      Local FileCount       As Long
      Local pFileInfo       As DWord
        
      Local pNode           As DWord
    
    
      pXmlDoc = XmlCreateObject("Msxml2.DOMDocument")'.6.0")
      IXMLDOMDocument_put_async pXmlDoc, %FALSE
    
    
      IXMLDOMDocument_load(pXmlDoc, $XMLFile)
      If XmlParseError_get_errorCode(pXmlDoc) <> 0 Then
         PrintL XmlParseError_get_reason(pXmlDoc)
      Else
        '------------------------------------------------------------
        '---Get thinAirTemplate Root
        '------------------------------------------------------------
          PrintL "-[Root Info]------------------------------------"
          pRoot = IXMLDOMDocument_get_documentElement(pXmlDoc)
          pRootName = IXMLDOMDocument_get_nodeName(pRoot)
          IXMLDOMElement_getAttribute(pRoot, "version", pRootVersion)
          IXMLDOMElement_getAttribute(pRoot, "type", pRootType)
          PrintL "Root name   : " & pRootName
          PrintL "Root version: " & pRootVersion
          PrintL "Root type   : " & pRootType
          PrintL "------------------------------------------------"
          PrintL
    
    
        '------------------------------------------------------------
        '---Get Header info
        '------------------------------------------------------------
          PrintL "-[Header   ]------------------------------------"
          pHeader = IXMLDOMElement_get_firstChild(pRoot)
          PrintL "Node name: " & IXMLDOMDocument_get_nodeName(pHeader)
          pNode = IXMLDOMElement_get_FirstChild(pHeader)
          While pNode
            Print IXMLDOMDocument_get_nodeName(pNode) & ": "
            PrintL IXMLDOMDocument_get_text(pNode)
            
            pNode = IXMLDOMElement_get_NextSibling(pNode)
          Wend
          PrintL
    
    
        '------------------------------------------------------------
        '---Files info
        '------------------------------------------------------------
          '[breakpoint] <Any note here. Breakpoint will be set to line following this statement>
          PrintL "-[Files    ]------------------------------------"
          pFiles = IXMLDOMElement_get_NextSibling(pHeader)
          PrintL "Node name: " & IXMLDOMDocument_get_nodeName(pFiles)
    
    
          '---Loop for each file
          pFile = IXMLDOMElement_get_FirstChild(pFiles)
          While pFile
            Incr FileCount  
            PrintL IXMLDOMDocument_get_nodeName(pFile) & " " & FileCount
    
    
            '---Loop for each file info
            pFileInfo = IXMLDOMElement_get_FirstChild(pFile)
            While pFileInfo
              Print IXMLDOMDocument_get_nodeName(pFileInfo) & ": "
              PrintL IXMLDOMDocument_get_text(pFileInfo)
              
              pFileInfo = IXMLDOMElement_get_NextSibling(pFileInfo)
            Wend
            
            pFile = IXMLDOMElement_get_NextSibling(pFile)
          Wend
          PrintL
    
    
          PrintL
    
    
      End If
    
    
      ' cleanup
      XmlRelease pRoot
      XmlRelease pHeader
      XmlRelease pFiles
      XmlRelease pFile
      XmlRelease pFileInfo
      XmlRelease pNode
      XmlRelease pXmlDoc
      
      PrintL "--- Press any key to finish ---"
      WaitKey
        
    End Function
    

    Template Example:

    <?xml version='1.0'?>
    <thinAirTemplate version="1.0" type="template">
    	<Header>
    		<DescriptionShort>Simple dialog</DescriptionShort>
    		<DescriptionLong>This template generates code for single modal dialog</DescriptionLong>
    		<Author>Petr Schreiber</Author>
    		<Contact>Drop user "Petr Schreiber" a message on ThinBASIC forum</Contact>
    		<Version>1.1</Version>
    	</Header>
    	<Files>
    		<File>
    			<Name>Dialog_</Name>
    			<Extension>tBasic</Extension>
    			<Code>
    				<![CDATA[
    
    
    				uses "UI" 
    
    
    				... here goes thinBasic code of the file ... 
    
    
    				]]>
    			</Code>
    			<Signature>hello</Signature>
    		</File>
    	</Files>
    </thinAirTemplate>
    
    Attached Files Attached Files
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  9. #19
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi Eros,

    the template dialog in beta has one little problem - when I click the templates, their code appears correctly. But when I use arrow keys to choose the template, the right panel with code does not update at all.
    It is probably not an issue, if the code section will be expandable as we discussed earlier.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 5
    Last Post: 18-03-2010, 08:28
  2. Christmas template :D
    By ErosOlmi in forum Web and Forum
    Replies: 3
    Last Post: 04-12-2008, 23:46
  3. Confusion with DIALOG GET/SET CLIENT, DESKTOP GET SIZE and DIALOG SET LOC
    By Michael Hartlef in forum UI (User Interface)
    Replies: 3
    Last Post: 03-10-2008, 19:23

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •