My question is : how to use the view identifier as parameter?
Code example:
Dim DrwDocument As DrawingDocument
Set DrwDocument = CATIA.ActiveDocument
Dim iParameter As Parameter
Set iParameter = DrwDocument.Parameters.Item("Drawing\Sheet.1\ViewMakeUp.1\Scale")
MyText.InsertVariable 0, 0, iParameter
but how can i access to the view identifier, and use it as parameter?
thank you!
Ok, do do this you must first create a parameter in the DrawingDocument object.
So you would have something like this added to your current code:
Dim IndetifierParam as Parameter
Set IdentifierParam = MyDrawingDocument.Parameters.CreateString("ViewIdentifier", "A")
MyText.Text = "View ID: "'note: there are two spaces from last character to end of the quote
MyText.InsertVariable Len(MyText.Text),0,IdentifierParam 'First parameter is insert position, second parameter is how many characters to overwrite, third is the parameter.
Now, in the drawing tree on the left you will see a Parameter Set with your new String Parameter. Double click the parameter and edit it...The drawing test will automatically update the drawing text with the changed parameter value. ALSO, as an added benefit, it's much easier in a VBA script to modify a parameter than the drawing text.
How to update or change this new Parameter:
IdentifierParam.ValuateFromString "A" 'add a string or variable here
Lastly, an extra tip, Go to Tools -> Options and click Parameters and Measure from the tree and on the First tab "Knowledge" check "With Value" and "With Formula" They are the first two checkboxes.
Related
I just created a properties file where I store my text.
In this SAP Walkthrough
for SAPUI5 the wrote the code like this
showHelloButtonText=Say Hallo
helloMsg=Hello {0}
The {0} is for the case that I want to set more parameters. But now the pop-up also displays the {0}. So the output is:
Hello {0}
The properties file is just a "File" in eclipse with the suffix ".properties", if this could help.
Thanks for any hints :)
Final result can be seen here: http://plnkr.co/edit/OGmJimjF2YZ46mv6DsF2?p=preview
What I did was the following:
When you want to bind a String with placeholders to a control in a view, you have to provide a formatter.
The formatter takes the placeholder String (Hello {0}) and the filler String and combines them
formatMsg: function(sMsg, sValue) {
return jQuery.sap.formatMessage(sMsg, sValue);
}
This formatter has to be called when your element is rendered, so you have to add it to your binding
<Label text="{
parts:[
{path:'i18n>helloMsg'},
{path:'/recipient/name'}
], formatter:'.formatMsg'}"
/>
The formatter takes two arguments, so we have to provide two values: The placeholder String and the value of the model.
The example in SAPs Walkthrough shows you both ways how to set the text of your message.
The first would be a static text, defined by:
helloMsg = Hello
The second option would be to use the {} brackets. This is a reference to different language options saved within a file in your workspace.
When you change the language of your browser it will then display different languages as set in your file.
I have a Configurable Form and i want to change the visibility of another field based on the value of a Drop-down list.
For example I have a Drop-Down list with entries A,B and the variable name for it is testDD.
I have a Text field smtpMailServer that I want to display only if testDD's value is A.
I have tried the following approaches in smtpMailServer's visibility without success:
return ((String) context.getVariable("testDD")).equals("A");
return (context.getVariable("testDD")).equals("A");
and I've also tried to add a script to testDD Change Selection Script with The following code
context.setVariable("ThisFormConfiguration", selectedItem);
And use the code above with ThisFormConfiguration instead of testDD. But it's not working.
Could you please help me?
Thanks!
I have tried the following approaches in smtpMailServer's visibility without success
The visibility script of a form component is only evaluated when the form is shown. You should keep it, but it only handles the initial condition.
and I've also tried to add a script to testDD Change Selection Script with
The following code context.setVariable("ThisFormConfiguration", selectedItem); A
Using the "Selection change script" property is the right idea, but your script has no effect. There is no live binding from the variables to the form components, the variable is read when the form is shown and updated when the user clicks "Next".
You have to use the following selection script:
formEnvironment.getFormComponentById("123").setVisible(selectedItem.equals("A"));
where "123" has to be replaced by the ID of the text field.
I have a MATLAB GUI that shows all variable names in the base workspace in a popupmenu. The user can then choose a variable. This variable is then passed into a function. My problem is that I cannot find a way to grab the variable's value from the popupmenu. I am getting a cell, which I convert into a string.
data = get(handles.popupmenu1,'String');
data = data{1};
The problem is that if the variable is named n, then this will return 'n', with quotes, when I need it to return it without quotes. So, when I try to get the value, it does not work.
data = evalin('base','data');
How do I remove the quotes from the string?
It's probably not the most efficient way, especially if you have a lot of variables in the popup menu, but could you store your variables in the handles structure of the GUI, and when the user selects a variable name from the popup menu it triggers a switch/case scenario in which you use strcmp, for example, to evaluate what the variable is and thus get its value form the handles structure?
Or maybe create some kind of lookup table in the UserData property of the popup menu, so that each 'String' displayed in the popup menu can be related to the corresponding variable, after which you get its value and can then pass to other callbacks?
I can't test it with a simple script right now and that's only ideas; I'll check tomorrow unless someone comes up with an idea in the meantime!
Ok, you can try this:
data = get(handles.popupmenu1,'Value');
Use 'Value' instead of 'String'.
I am trying to tick a check box on a form when I select one of many combobox values that begins with (REF) - this is code that stands for Referral closure.
this is what I've done..it's not working
Private Sub ReasonForInappriopriateReferral_AfterUpdate()
If Me.RsnForInappropriateRef.Value Like "(REF)*" Then
Me.Check66 = True
End If
End Sub
Please help, I was previously trying to conditional format a label to a different colour if the closure reason was a Referral closure, but couldn't do that either and think it could be down to the IF Like command.
I added two controls exactly as you indicated. I populated my combo by setting the Row Source Type to a Value List, and the Row Source to "Blah Blah";"(REF) - Jackson";"Two Times";"(REF) - Tyson"
I put this in the Click event of a button:
If Me.RsnForInappropriateRef.Value Like "(REF)*" Then
Me.Check66 = True
Else
Me.Check66 = False
End If
it behaved exactly as expected. I then moved it to the AfterUpdate event of the combobox, and again it worked flawlessly. The only thing I can see is that in your example, the combobox does not have the same name as your sub (ReasonForInappriopriateReferral vs RsnForInappropriateRef). Are you sure your names are right?
I am developing one interface in Perl/Tk.
In that I am using one optionmenu to list the names of the users.
And while selecting the user from optionmenu it should display corresponding date of birth of the employee.
And I should be able to update the date of birth of the selected user.
I have written the following code.
$dob_label = $form_name -> Label(-text=>"BirthDay")->place(-x=>150,-y=>200);
$dob=$form_name->DateEntry(-width=>11,-parsecmd=>\&parse,-formatcmd=>\&format)->place(-x=>250,-y=>200);
$ename = $form_name->Optionmenu(-variable=>\$select_value,-options => [#names],
-command=>sub {&get_id_date($hash_ref,$eid,$dob,$_[-1])})->place(-x=>250, -y=>100);
$post_button=$form_name->Button(-text=>"Add",-command=>[\&Add_Birthday,$select_value,$dob,"edit"])->place(-x=>250,-y=>275);
The function get_id_date is used to get the id and dob of employee using the name of the employee.
It is returning the correct id and dob.
Then I edited the dob of the employee.
And I am calling Add_Birthday function to save the changes into database.
But what is the problem in this is,the variable $select_value is always having the value of first name in the optionmenu.
Actually it should have the value of the last selected item in the optionmenu.
So what is the problem in this code,
Please give the solution for this also.
Thanks in advance.
When you create the Button, you are passing the current value of $select_value to the button/command set up. By the time you press the button, the old value of $select_value has already been evaluated and set in the command argument list. You need to make your command a closure, so that $select_value is not evaluated until the button is pressed, e.g.:
-command => sub { Add_Birthday($select_value, "dob", $edit) }
For completeness, I should also mention that another way of doing this is to pass in references:
-command => [\&Add_Birthday, \$select_value, "dob", \$edit]
But that requires rewriting the function to accommodate the references in the argument list.