Can't call HideBubble within conditional statement - thinkscript

Good evening, all. I have a script where I would like to let the user choose whether to show the price bubbles on my plot. I've created an input parameter but it looks like you can't call the hide function inside an if block. The following seems straightforward but doesn't compile... any workarounds?
input hidePriceBubbles = no;
.
.
.
plot p_amLows = amLows;
p_amLows.SetStyle(Curve.POINTS);
p_amLows.SetDefaultColor(Color.YELLOW);
if hidePriceBubbles then {
p_amLows.HideBubble(); <--- "can not be called within branching"
} else {
}

Newbie mistake on my part. I didn't realize that the ThinkOrSwim UI automatically provides a settings panel for every plot in a script. Among the choices on this panel is one that allows the user to hide the price bubble. No coding required... it is baked into the system.

Related

Using jqGrid I need to Show a Hidden Column Based on UserData Parm

Using jqGrid 4.15.6-pre - free jqGrid
I am wondering why the following code will not show the specified column.
var cm = $('#nrtslist').jqGrid('getColProp','override');
cm.hidden = false;
This can't be done this way.
All the concept of the grid is that you can read the properties of colModel or any other grid option, but changing it does not mean that it will change something. With other words something must happen in order to change the property.
These properties describe the current status (in most cases) or this is a consequence, not a cause.
To change something in grid you will need to use the appropriate method or do your own one.
In your case you will need to use the showCol or hideCol methods
$('#nrtslist').jqGrid('showCol','override'); // this will show the column
$('#nrtslist').jqGrid('hideCol','override'); // this will hide it.

Django Dynamic Form Selection

I want to achieve Dynamic form selection using Django
Vehicle_Type_Choices = (
(‘car’,’Car’),
(‘bike’,’Bike’),
(‘auto’,’Auto’),
)
vehicle_type = models.CharField(max_length=10,choices=Vehicle_Type_Choices)
Now I have 3 different forms (I.e CarForm, BikeForm, AutoForm) for Vehicle specifications based on the type of vehicle selected.
Now, I want if the user selects the Choice Car above, I want to display the CarForm (or) if the user selects Bike, then BikeForm has to be displayed for further filling of Data.
Please Help me to achieve the above scenario .
Thanks and regards
One of the most simple ways would be to just go to another page after a selection has been made (i.e. wizard type), anything else would need lots of javascript.
There is one package that can do form splitting, but never use it and not sure if/how can help in your situation, but I guess its worth taking a look: django-formtools

Eclipse Scout Neon table cell mouseover

I would like to know how to achieve mouseover on a cell, if a column is too short for full text.
So, if I have column with fix width, and text is too long, how to present whole text with mouseover in a cell.
You can dynamically add a mouse over tooltip on any cell by overriding the
execDecorateCell(Cell view, ITableRow row, IColumn<?> col) method in AbstractTable and setting your tooltip text like
#Override
protected void execDecorateCell(Cell view, ITableRow row, IColumn<?> col) {
super.execDecorateCell(view, row, col);
view.setTooltipText("Hi there: " + view.getText());
}
Unfortunately, this does not consider if your text length exceeds the length of your column/cell. It will set the tooltip text in any case! So far, I am not sure, whether (or how) it is possible to calculate (in pixels?), if the actual string length inside a cell exceeds ones column length. Maybe you could try something, that takes the actual string length into account (java.lang.String.length()) and only provide a tooltip if a certain length is given.
Let me know, if this is works for you!
Best regards,
Matthias
The tooltip for truncated text in a table cell is currently only shown if it is not possible to resize the column. This is done by purpose because the tooltip may be very annoying. The code responsible for this is in the file Table.js:
scout.Table.prototype._isTruncatedCellTooltipEnabled = function(column) {
return !this.headerVisible || column.fixedWidth;
};
If you don't like this behaviour, you could adjust the JavaScript code. There are mainly two ways for doing this:
Replace the original function
Extend the table and override the function
With the first approach you replace the actual function, so everytime a scout.Table gets created this function is used. With the second approach you need to make sure your new table is used. In order to do this you need to specify a mapping between the object type and the constructor which will be used whenever an object should be created using scout.create(objectType). This is normally done by convention, so if you write scout.create('Table') a new scout.Table will be created. Because you now want to create a custom table you need to add the mapping to scout.objectFactories.
For me, the first approach feels more like patching, whereas the second one is a cleaner solution. The advantage of the second solution is that the original object stays untouched and you could, at least theoretically, still create regular tables. That's why I suggest to use the second approach. But in the end it is probably a matter of taste.
In both ways, you need to create one or more JavaScript files, register them in yourproject-module.js and include this module in your index.html. The files could look like this:
Approach 1:
patches.js
scout.Table.prototype._isTruncatedCellTooltipEnabled = function(column) {
return true;
};
Approach 2
CustomTable.js
scout.CustomTable = function() {
scout.CustomTable.parent.call(this);
};
scout.inherits(scout.CustomTable, scout.Table);
/**
* #override
*/
scout.CustomTable.prototype._isTruncatedCellTooltipEnabled = function(column) {
return true;
};
objectFactories.js
scout.objectFactories = $.extend(scout.objectFactories, {
'Table': function() {
return new scout.CustomTable();
}
});
Remember: The scout JavaScript code is not api and may change anytime. You won't get compile errors if the function will be renamed as you are used to with java. So before adding a lot of custom JavaScript code to adjust the default behaviour you should consider opening a bug first so that it can be fixed in Scout. It could help others as well.

Ultragrid entire column selection when header is clicked

This might seem a very easy problem but I am stuck and can't find a way out of it. I am using ultragrid in my form with several columns. My issue is when I am trying to click on the column header I am expecting my entire column to be selected but it doesn't. I assumed the SelectTypeCol is the property for my column selection but it did not work either. I also tried to add each column to Selected.Columns collection like this UltraGrid1.DisplayLayout.Bands(0).Columns(i).Header.Selected = True but it didn't work for me either. I believe Selected is only available during runtime but not at the design mode.
So if there is an easier way to make this work, please let me know.
Thank you
You are looking for the property HeaderClickAction
grid.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Select
This will automatically flip the selection state of the entire column as Selected (or Delected) when you click on the header. Of course this means also that you loose the ability to automatically sort on all columns
You can programmatically set the Selection state of a column with code like this (C#)
grid.DisplayLayout.Bands[0].Columns["youColumnKey"].Header.Selected = true;
this will permit to leave the HeaderClickAction property to SortSingle or SortMulti, but you have to handle the situation using code and appropriate events
You need to have an InitializeLayout event on your grid. in this event you need to set the chekboxsynchronization to default and it should work here is sample code
private void ultraGrid1_InitializeLayout(object sender,
Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
e.Layout.Bands[0].Columns.Add("CheckBox");
e.Layout.Bands[0].Columns["CheckBox"].Style = ColumnStyle.CheckBox;
e.Layout.Bands[0].Columns["CheckBox"].Header.CheckBoxVisibility = HeaderCheckBoxVisibility.WhenUsingCheckEditor;
e.Layout.Bands[0].Columns["CheckBox"].Header.CheckBoxSynchronization = HeaderCheckBoxSynchronization.Default; <-- make sure it is set to default here
}

How to iterate through all <select> field options in behat / mink

I am testing a product search form. Products may be searched by different parameters (like status, material, wight etc.). When I want to search by status I do the following:
Scenario Outline: search by status
When I select "<status>" from "search_form_status"
And I press "Search"
And I wait for 3 seconds // implemented
And I follow random link from test result table // implemented
Then I should see "<status>" in the "div#status" element
Examples:
|status |
|enabled |
|disabled|
And everything is fine. But if I wanted to test the same search for say, productMaterial I'm stuck as product materials are the subject that can be changed at any time (we may need new materials, may edit material names, or delete old unused ones). Add to that the fact that materials will differ on testing environment and on production site.
I know that I can do something like:
Given I select product material
And implement the step with foreach loop like this:
$matList = $this->getSession()->getPage()->findAll('css', "select option");
foreach($matList as $material){
// DO SOMETHING
}
}
But how would I create all the other steps like in the status example?
I imagine that I would want to use a $material variable in the following steps in my search.feature file for the steps that follow that custom step. But how do I do that?
How would I iterate through all of the options list and do a bunch of steps in each iteration?
You'll need to write the PHP code that runs the individual steps that you want, inside your method that contains the code to select all the options.
For example:
$handler = $this->getSession()->getSelectorsHandler();
$optionElements = $this->getSession()->getPage()->findAll('named', array('option', $handler->selectorToXpath('css', 'select ));
foreach ($optionElements as $optionElement) {
$this->getSession()->getPage()->selectFieldOption('portal', $optionElement->getValue());
$this->pressButton("show");
$this->assertPageContainsText(" - Report Report");
}