How to bold every instance of a phrase in an attribute on doors with a DXL? - scripting

I have an attribute/column called "X" in a DOORS module. I want to bold the 3 phrases "America" and "Bahamas" and "Czech Republic" whenever they appear in this attribute.
BUT I also want to be able to manually edit the attribute whenever I want. Is this possible with a DXL attribute?
What I'm doing is I go into edit-mode on the DOORS module, click Edit -> Attributes -> "X" -> Edit... -> check DXL attribute -> Browse... -> New, write the code -> Ok, close all windows, Tools -> Refresh DXL Attributes. Correct?
Here's the general setup, idk the syntax:
Object o
for o in current Module do{
if((o."X") contains "America" or "Bahamas" or "Czech Republic")
{
font bold "America" or "Bahamas" or "Czech Republic"
}
}
Also, most cells will have all 3 phrases in it.

Related

How to make key shortcut groups in ios/catalyst

In my app, I am using UIViewController.addKeyCommand() to create keyboard shortcuts. When user holds CMD, a nice table of all commands available is automatically shown. However in iOS 15, these table can be ordered into groups. At least system tables are:
(groups System, Multitasking, Split view, Slide over). Is it possible to do this grouping also in my app? If yes, how?
Got it working, but it needs different mechanism then UIViewController.addKeyCommand()
In AppDelegate, override func buildMenu()
Inside, create one or more UIMenu objects, and populate their children property with UIKeyCommandObjects .
Insert menus in builder using builder.insertSibling() or similar.
That's all. Every UIKeyCommand thus added to menu will work as if it was added by UIViewController.addKeyCommand(). And every UIMenu will work as a group of commands, where UIMenu.title property is the title of the group.
override func buildMenu(with builder: UIMenuBuilder) {
super.buildMenu(with: builder)
if (builder.system != .main) {
return
}
let cmd = UIKeyCommand(title: "TestCmd", action: #selector(MainViewController.ref!.actTest(sender:)), input: "x", discoverabilityTitle: "Test command")
let menu = UIMenu(title: NSLocalizedString("Test group", comment: "hotkey group name"),
image: nil, identifier: UIMenu.Identifier(rawValue: "myapp.menu.ios.test"),
children: [cmd])
builder.insertSibling(menu, afterMenu: .view)
}

How to make a DOORS boolean attribute/column "False" if another attribute/column is not empty with DXL?

I have 2 attributes/columns. "A" and "B". A is as string of text. B is a boolean that can be True or False (when you edit it in DOORS, it's a drop down with 2 options T/F).
I want to use DXL to make B False if A is not empty.
Here's what I have so far, but I'm very new and unsure the syntax:
Object o
for o in current Module do{
if((o."A") == null)
{
o."B" = "False"
}
}
What I'm doing is I go into edit-mode on the DOORS module, click Edit -> Attributes -> "B" -> Edit... -> check DXL attribute -> Browse... -> New, write the code -> Ok, close all windows, Tools -> Refresh DXL Attributes. Correct?
When I Refresh, nothing happens, also when I clicked "check" after writing the code, there was no errors. Also when I go back the Edit -> Attributes and look back at the DXL for "B", I don't see my script there...
Try this dxl code
//Go to Edit -> Attributes, select 'B' attribute; select Edit and check the checkbox 'DXL attribute', click the 'Browse' button and paste the following code
//Press F5 to refresh DXL attributes
//Or 'Tool -> Refresh DXL attributes' to refresh DXL attributes
if((obj."A") == null)
{
obj.attrDXLName = "False"
}
else
{
obj.attrDXLName = "True"
}
Follow the below steps to see or edit the dxl code
Select the DXL attribute
Click Edit
Check the DXL Attribute box
Click Browse
Click Current

How do I retrieve text from an html element?

How do I get the caption from a button?
decorateOn : String -> Html Msg -> Html Msg
decorateOn selectedCaption button =
if button.text == selectedCaption then
button [ class "selectedNavigationButton" ] []
else
button [ class "navigationButton" ] []
button does not have a field named text. - The type of button
is:
Html Home.Msg
Which does not contain a field named text.
Note, I realize that the "button" is really of type Html Msg.
You need to turn your thinking on its head. Rather than seeing what is in the button text, you need to set the text at the same stage as setting the class. So that gives you something like
decorateOn : String -> Html Msg -> Html Msg
decorateOn selectedCaption button =
if selectedCaption == "the selected value" then
button [ class "selectedNavigationButton" ] [text selectedCaption ]
else
button [ class "navigationButton" ] [text selectedCaption]
You can't get the text from a button without resorting to hacks involving ports and JavaScript. Moreover, you can't really inspect anything about the Elm Virtual DOM from within Elm.
Instead, try to refactor your app so that you can get the information from your model.

Check Word Doc for Field Code before applying

So I've coded a VSTO addin using vb.net to add a header to a document in Word however from historical methods we have lots of templates with field codes. My addin does not account for these and simply strips the header to add xxxxx value you choose from the pop up.
I need my code to be smart enough to 'spot' the field code and append or if it does not exist e.g. a blank document then continue running as expected. I can append this field code using the below code:
wordDocument.Variables("fieldname").Value = "xxxx"
wordDocument.Fields.Update
However my tool then adds the header as normal and strips most the content from the template. So effectively my question is how would I code a check for this before proceeding. So in plain English I would need my addin to go from this:
Load pop up
Set xxxx value in header
Close
To this:
Load pop up
Check Document for existing "fieldname"
If "fieldname" exists then
wordDocument.Variables("fieldname").Value = "xxxx" (from pop up selection)
wordDocument.Fields.Update
However if "fieldname" doesn't exist then continue as normal....
Sorry if this is a little complex and/or long winded.
Thanks in advance.
Here is my code in C#, hope this might help you to code in VB.Net
foreach (Section sec in doc.Sections)
{
doc.ActiveWindow.View.set_SeekView(WdSeekView.wdSeekCurrentPageHeader);
foreach (HeaderFooter headerFooter in sec.GetHeadersFooters())
{
doc.ActiveWindow.View.set_SeekView(headerFooter.IsHeader ? WdSeekView.wdSeekCurrentPageHeader : WdSeekView.wdSeekCurrentPageFooter);
if (headerFooter.Range.Fields.Count > 0)
{
//Append to existing fields
UpdateFields(headerFooter.Range.Fields);
}
else
{
//Add field code
AddFieldCode(headerFooter.Range);
}
}
doc.ActiveWindow.View.set_SeekView(WdSeekView.wdSeekMainDocument);
}
Extension method to iterate through the header types
public static IEnumerable<HeaderFooter> GetHeadersFooters(this Section section)
{
List<HeaderFooter> headerFooterlist = new List<HeaderFooter>
{
section.Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary],
section.Headers[WdHeaderFooterIndex.wdHeaderFooterFirstPage],
section.Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages],
section.Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary],
section.Footers[WdHeaderFooterIndex.wdHeaderFooterFirstPage],
section.Footers[WdHeaderFooterIndex.wdHeaderFooterEvenPages]
};
return headerFooterlist;
}

TinyMCE remove item from context menu

Can any one please let me know how we can remove items from a TinyMCE ContextMenu. I.e., normal Cut, Copy, Paste items?
I've seen several references to add items to the context menu shown inside the editor, but not for removing the same.
Please help :)-
When you initiate TinyMCE, you can explicitly state which buttons to include:
tinyMCE.init({
...
theme_advanced_buttons1 : "bold,italic,underline",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : ""
});
(example taken from the docs)
Edit
Sorry, the question is about the Context Menu (a.k.a the right-click menu).
Have you tried this plugin which lets you do this?:
tinymce.init({
plugins: "contextmenu",
contextmenu: "link image inserttable | cell row column deletetable"
});