General XMetaL Discussion

  • chrisb

    ToggleInline

    Participants 2
    Replies 3
    Last Activity 12 years, 3 months ago

    I'm using XMAX v6.0 and am trying to use the ToggleInline function on the Selection object of the control.  I cannot get the function to work and am receiving no feedback from the control.

    Example code: xmaxControl.Selection.ToggleInline(“B”)

    I have also tried with the ToggleInlineNS and the appropriate namespaces.  I've cut back the schema and file to be as simple as possible and still nothing.

    Any help would be much appreciated.

    Chris

    This is the xml file:

                  xsi:schemaLocation=”http://www.tempuri.org/paper ./schema.xsd”
                  xmlns=”http://www.tempuri.org/paper”>
     
       

                  Loremb ipsum dolor sit amet, consectetur adipiscing elit. Nullam lacus dolor, pretium vel semper non, porttitor ac elit. Quisque non urna ante, a dictum mauris. Phasellus non mauris purus, eget egestas erat. Integer tristique lacus nec mi posuere venenatis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nullam nunc libero, fermentum vitae aliquet a, lobortis non sem. Duis et justo sit amet tellus facilisis cursus in laoreet magna. Nulla euismod mollis faucibus. Phasellus luctus blandit orci, id pellentesque diam posuere a. Praesent cursus purus vitae dolor pretium sodales. Donec dictum egestas nulla ut faucibus. Nunc at diam sit amet urna adipiscing tincidunt. Praesent commodo augue eget neque condimentum ultrices vitae eget nulla. Nulla facilisi. Phasellus convallis consectetur nulla, a commodo purus commodo ut.
         
       

     

    and this is the schema:


      targetNamespace=”http://www.tempuri.org/paper”
      elementFormDefault=”qualified”
      xmlns=”http://www.tempuri.org/paper”
      xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>

     
       
         
           
         

       

     

       
       
         
           
             
               
                 
                   
                     
                     
                     
                     
                     
                     
                     
                   

                 

               

             

           

         

       

     

    Reply

    Derek Read

    Reply to: ToggleInline

    Unfortunately, it looks like this is a known issue that has yet to be addressed, or at least there is another issue that looks like this one. I'm not sure exactly what the exact issue is here because other Schemas and instances I have tried are OK. Development will be looking into it though.

    In my testing the following are working:
    Selection.Surround("B")
    Selection.SurroundNS("http://www.tempuri.org/paper","B")
    Selection.RemoveContainerTags()

    So, all is not lost. I believe adding a little bit of logic together with those APIs makes it possible to obtain the same results. Something like this:

    'XMetaL Script Language VBScript:
    SET rng = ActiveDocument.Range
    if (rng.ContainerName = "B") then
    rng.RemoveContainerTags()
    else
    rng.Surround("B")
    rng.Select()
    end if

    (written in VBScript as it looks like you are either working with VB or VBScript, just a guess)

    Reply

    steves

    Reply to: ToggleInline

    The problem is with the schema itself. The paragraph element contains strong, emphasis and underline elements inline e.g.



    (same with the super/subscript).

    What you need to do is create a type for the above as follows…

    …etc

    and then define the type…


     
       
     

    Note that the emphasis is included (as well may the underline) to allow strong/emphasis combinations.

    Now you need to include the elements defined using the ref attribute instead…



    The modified schema is thus:


      targetNamespace=”http://www.tempuri.org/paper”
      elementFormDefault=”qualified”
      xmlns=”http://www.tempuri.org/paper”
      xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>

     
       
         
           
         

       

     

     
     
     

     
       
         
         
       

     

     
       
         
         
       

     

     
       
         
         
       

     

       
       
         
           
             
               
                 
                   
                     
                     
                     
                     
                     
                     
                     
                   

                 

               

             

           

         

       

     

    Even though the previous schema was perfectly valid and the xmax tool itself validates it, I do not know why it does not work in the previous form. This does however work and I have tried it in a sample .net application (which is attached).

    Regards
    SteveS

    Reply

    Derek Read

    Reply to: ToggleInline

    Thank you for finding this. I'll include this updated info with my report to development.

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support