Do MT4 objects get deleted themselves when the corresponding bar goes off the chart? - object

I create small trend lines to augment an indicator that I use. The drawing of the trend lines work perfect. However, when the chart has scrolled past the number of bars that MT4 is set to, the objects seems to pile up.
The trend line has a open time and a close time in the ObjectCreate() command (as shown below):
bool bSuccess = ObjectCreate( 0, sName, OBJ_TREND, iIndicatorWindow,
dtOpenTime, dOpenPrice,
dtCloseTime, dClosePrice
);
I would think that as the bar scrolls off the screen, the corresponding trendline will be deleted as well.
Could you please let me know if I need to delete the objects that scroll off programatically (instead of waiting for MT4 to delete them)?

Once created, objects remain alive, does not matter how much time passed. If you need - try to delete the object, if not - leave it and seek for the newest object (loop over ObjectsTotal()) to find the newest one that meets your criteria.

Related

Can't resize columns in grid

I have several custom screens which have grids. On all but one of them I can resize the columns. In the one where I can't resize, I'm using BLC code to determine when to hide the column and what to display as the name of the column. I do this as follows:
PXUIFieldAttribute.SetVisible<xTACOpenSourceDetail.string03>(OpenSourceDataDetail.Cache, null, true);
PXUIFieldAttribute.SetDisplayName<xTACOpenSourceDetail.string03>(this.OpenSourceDataDetail.Cache, ossd.String03);
All my grids are set up the same way, except for this one difference. Is there an attribute or property I can set to make sure these columns are sizable as well?
After dissecting this for a while, The solution I've come up with was to re-create the entire screen from scratch. This corrected the issue, and I can only conclude that something became corrupted within the original screen and could not be refreshed or recompiled. It is still unknown what caused the issue to begin with.

How to replace one records with many (ie explode a group into pieces) when entering?

I am trying to figure out the best approach for something - I have added an additional table to the Sales Order screen as a new tab and it works fine to save records into it. The next thing needed is to potentially explode a value into many lines if it is a certain type. So if they enter a "kit" into my grid/tab - we would want to replace the kit with its components and not have the kit in the grid anymore.
I know how to insert the records etc. My biggest concern is which event to do the work under (field or row level and -ed vs -ing) . I know I could potentially create an endless loop if I don't do it properly.
**edit - I tried using RowInserting - I can cancel the inserting and add my records in there - however it does not trigger the screen to refresh from the cache. If i Save the order - it will display my new rows properly. however, i dont want to do a save in my code. I am also concerned about it triggering another rowinserting.
With rowinserted - it seems to be the same with the screen not refreshing and also i get an error about the row that i deleted.
We had a similar request and what we did is instead of adding the item in grid level and waiting for a trigger, we added a grid tool bar button that pops up a small smart panel to select the kit item, its version and the quantity required. Then we inserted the component lines to the grid with required calculations.

Change format of all data labels of a single series at once

I have an Excel 2010 chart, with several series. I have added data labels to one of the series. I want to change the font size of all labels of that series at once. Can it be done?
Note that if the contents of data labels are combinations of the three standard options in the Format Data Labels dialog ("Series Name", "X Value", or "Y Value"), I simply change the font size in the ribbon and it works.
But if data labels contain cell references (i.e., formulas), I could only change the font size of one label at a time.
I guess a macro would help. I tried something a while ago, and faced a sequence of problems (do not remember exactly which).
Anyone knows of a shorter/alternative solution?
It appears I found the cause.
Referring to the figure, whenever any of the cells referred to by the data labels is empty (e.g., deleting the contents of D4), I cannot change the font size.
If I reinstate D4, I can change the font size again. This is reproducible for the simple worksheet/chart of the figure.
According to this,
Workaround 1: Fill up all empty cells referred to. Change the format of labels. Remove added contents.
Workaround 2: Change to a dummy range for the data labels, which has no empty cells. Change the format of labels. Switch back to your intended range.
This might require The XY Chart Labeler, an excellent add-in by Rob Bovey.
This does not always work (there are cases where one cannot change font even with all non-empty cells), so there should be another possible cause for the problem (besides the one reported).
A workaround:
For the workbook, Save As... (you can even use the same workbook name). The problem goes away.
But if you close the file and open it again, the problem reappears.
Most of the times it works.
A workaround (found prior to #1):
A very poor solution, but which possibly saves quite a few keystrokes/mouse clicks in many cases. Select the whole chart, and change the font size in the ribbon. It will change all text. Then recover the font size of all other text but the data labels.
It won't work in charts with more than one series with such data labels, if you want them to have different sizes!
A quick way to solve this is to:
Go to the chart and left mouse click on the 'data series' you want to edit.
Click anywhere in formula bar above. Don't change anything.
Click the 'tick icon' just to the left of the formula bar.
Go straight back to the same data series and right mouse click, and choose add data labels
This has worked in Excel 2016. Purely by luck I worked this out saving a great deal of time and frustration.

Microsoft Power Point 2010 Cannot Propagate Page Number Footer on Master Slide

I am making a power point template and I have a master, and dozens of slides under it. My master has a footer (Page Number)
[ <#>]
In the bottom right corner. (You can see this by opening up a blank presentation and viewing the master).
What I want to do is add some text such as
[ AUTHOR HERE <#> ]
and propagate this from my master to all the slides that inherit this master. But this doesnt work. It is absolutely dumb and ridiculous.
NOTE: I am aware of the functionality that I can do Insert -> Header & Footer -> Check the right boxes -> Apply Changes to All and this will come in handy when I want to reflect the change.
I can change the Footer and apply it in the Slide Master View and the Footer is updated. However, and this is the most frustrating part, when I add AUTHOR HERE to the Slide Number Part of the footer, those changes will not get reflected in the child slide!!
There is a fix, and it is to do it manually, but I would like this template to be dynamic so all you gotta do is change the name in the Page Number placeholder and it will update the rest of the template. I can make the PAGE NUMBER RED AND BOLD, I can move the Page Number place holder around and it updates the child slides accordingly, but when I add text into the box, it doesn't propagate! Why?!
Again, I'm trying a proof of concept from a default presentation.
I swear this is impossible.
In the redesign from PPT 2003 to 2007, MS solved a rather small problem that affects a moderate number of people and in so doing, created a big problem that affects anyone who uses headers/footers/etc. They haven't seen fit to fix it.
A couple of things:
I think you'll need to apply your "Author Here" text to the slide placeholder on each of the layouts (the "slides" indented beneath the main master in Master view).
To have the text apply, you'll want to go to Insert | Headers/Footers, remove the check next to Slide Number, click Apply to all. Then repeat to put the check next to Slide Number again. IOW, turn the slide numbers off then turn them back on again. This forces them to regenerate.
Finally, just in case: the <#> you see there isn't really a normal character, so typing <#> won't work. If you type your "Author Here " and then while the text cursor's still in the text box, choose Insert | Date&Time, you'll get the correct character.

Inserting a Page Break between charts

I have an Excel worksheet on which I am organizing a bunch of charts. The charts stack vertically, on upon the other (with some spacing and labels in between for organization). The charts don't fit on a single printed page, so I have to insert page breaks at the right places. The number of charts and the size of each chart can change, so I don't know exactly where to put the page break until run time.
I do know that I want to print two charts on each page, however. So, what I want to do is to put a page break either after the second chart or before the third chart (either way). But it looks to me like page breaks are always associated with a row, not with an object (like a chart).
Is there a way to either:
1) associate a page break with an object (e.g. ActiveSheet.HPageBreaks.Add before:=ActiveSheet.ChartObject("myChart3"))
2) determine which row the top of the object sits in. If I could determine this, then I can easily place the page break at that row. For example, I can get ActiveSheet.ChartObject("myChart").Top, but I don't know what row this corresponds to. I tried setting every row to a height of 1 and then doing a one-to-one correspondence, but it doesn't match up.

Resources