General XMetaL Discussion
chrisb July 2, 2010 at 2:29 pm
ToggleInlineJuly 2, 2010 at 2:29 pmParticipants 2Replies 3Last Activity 12 years, 7 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.
This is the xml file:
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:
Derek Read July 2, 2010 at 6:58 pm
Reply to: ToggleInlineJuly 2, 2010 at 6:58 pm
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:
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
(written in VBScript as it looks like you are either working with VB or VBScript, just a guess)steves July 9, 2010 at 6:53 am
Reply to: ToggleInlineJuly 9, 2010 at 6:53 am
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…
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:
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).
- You must be logged in to reply to this topic.