Teechart + activeX + Vertical Scroll - activex

I am trying to add scroll tool to my chart but not able to do that . Below is the code
{
m_chart1.ClearChart();
m_chart1.GetPage().SetMaxPointsPerPage(5);
wchar_t tmp[30]={0};
wchar_t t[10] = L"T%d";
int i = 0;
m_chart1.AddSeries(1);
wsprintf(tmp,t,i);
m_chart1.Series(i).SetColor(RGB(rand(),rand(),rand()));
m_chart1.Series(i).SetLegendTitle(tmp);
m_chart1.Series(i).FillSampleValues(100);
m_chart1.Series(i).GetMarks().SetVisible(false);
m_chartNavigation.SetChartLink(m_chart1.GetChartLink());
m_chart1.GetAspect().SetView3D(false);
m_chart1.GetTools().Add(22);
_variant_t vardata;
VariantInit (&vardata);
vardata.vt = VT_BYREF;
vardata.byref = &m_chart1.GetAxis().GetBottom();
m_chart1.GetTools().GetItems(0).GetAsAxisScroll().SetAxis(vardata);
m_chart1.GetTools().GetItems(0).SetActive(true);
}
Code Compiles properly but arrow is not displayed on Axis.
Thanks
Akshay

Code Compiles properly but arrow is not displayed on Axis
I'm not sure about what m_chartNavigation from your code is. Is it a ChartPageNavigator?
Note this component adds a navigation bar separate from the chart.
If you want to show some arrows to scroll the chart, you should use the AxisArrow tool, not the AxisScroll tool, that is the 2, not the 22.
m_chart1.GetTools().Add(2);
m_chart1.GetTools().GetItems(0).GetAsAxisArrow().SetAxis(vardata);

I have modified your code, so the AxisArrow tool works in correct way and allow you do scroll of the axis as you want. Therefore, please see next code and consider the indications, because you can use the code without problems.
Considerations:
1.- Check if you there are all classes in the folder as you have your project. If you doesn't have all classes you must copy these from folder Uitilities\New VC Classes as you find, in the folder where you installed TeeChartActivex. The folder is similar as next C:......\TeeChart Pro v2012 ActiveX Control\Utilities\New VC Classes
2.- Use next includes in your code:
#include "stdafx.h"
#include "XXXXX.h"
#include "XXXXX.h"
#include "series.h"
#include "axes.h"
#include "axis.h"
#include "TeeChartDefines.h"
#include "aspect.h"
#include "zoom.h"
#include "scroll.h"
#include "environment.h"
#include "marks.h"
#include "page.h"
#include "lineseries.h"
#include "axisarrowtool.h"
#include "toollist.h"
#include "tools.h"
#include "comutil.h"
#include "afxdisp.h"
3.- The code has been made on the OnInitDialog() of the project.
Code:
Could you tell us if next code works in your end?
{
.
.
.
// TODO: Add extra initialization here
m_tChart1.ClearChart();
long index = m_tChart1.AddSeries(scLine);
m_tChart1.GetAspect().SetView3D(false);
m_tChart1.GetPage().SetMaxPointsPerPage(5);
m_tChart1.Series(index).SetColor(RGB(rand(),rand(),rand()));
m_tChart1.Series(index).SetLegendTitle("Hello");
m_tChart1.Series(index).FillSampleValues(100);
m_tChart1.Series(index).GetMarks().SetVisible(false);
long index1 = m_tChart1.GetTools().Add(tcAxisArrow);
//SetAxisArrow Tool to do scroll.
m_tChart1.GetTools().GetItems(index1).GetAsAxisArrow().SetAxis(COleVariant(short(atBottom)));
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
I hope will helps.
Thanks,
Sandra.

Related

How to translate MainMenu using TLang in RAD studio?

I'm creating a pretty simple app in RAD studio 10.3, c++ builder. I've decided to add languages support. I found the TLang component - it was exactly what I wanted. It works fine for all "on the form" components like Edit, Label, CheckBox, etc. But it doesn't work for the main menu (TMainMenu). It just doesn't react to language switches.
Switches are done this way
void __fastcall TForm1::EnLang_menuClick(TObject *Sender)
{
LoadLangFromStrings(Lang1->LangStr["EN"]);
// Lang1->Lang = "EN" // I tried this way - same result
}
void __fastcall TForm1::RuLang_menuClick(TObject *Sender)
{
LoadLangFromStrings(Lang1->LangStr["RU"]);
}
My guess is TLang only checks controls for strings switches, but TMainMenu isn't a child of the TControl. Anyway - how to translate a main menu using TLang? Sure, I can write something like TLang myself and make it translate any components I want, but it needs time, so I was looking for something ready to go now.

How can I show a hidden column of a grid using the Vaadin Testbench?

I am doing some integration tests, and I have replaced some tables with a grid. At this moment, I have some visible columns by default and other columns are hidden as follows:
column6.setHidable(true);
column6.setHidden(true);
Now I am trying to do some integration tests. For getting the grid, I can use the method (is the only grid present in this view):
$(GridElement.class).first();
This works fine. But for my test (with Vaadin Testbench), I need to check some values that are inside the hidden columns of the grid. I am talking about this button:
I have tried to use the Vaadin debug console to get the name of the button that allows the user to show/hide columns, but the debug console only can select the entire grid element, not this menu.
Also I have check if inside the GridElement exists any kind of already implemented method that give me access to this menu without any success.
Usually, chrome developer tools (or similar for firefox and ie / edge, etc) is your best friend in such cases. So far I'm not aware of anything dedicated for that particular button. However you can workaround this limitation by selecting the items which compose this feature by their specific classes:
The below test method shows a quick implementation which should give you a starting point:
public class GridManipulationTest extends TestBenchTestCase {
#Before
public void setUp() throws Exception {
System.setProperty("webdriver.chrome.driver", "D:\\Kit\\chromedriver_win32\\chromedriver.exe");
setDriver(new ChromeDriver());
}
#After
public void tearDown() throws Exception {
// TODO uncomment below after checking all works as expected
//getDriver().quit();
}
#Test
public void shouldOpenGridColumnVisibilityPopupAndSelectItems() {
// class for the grid sidebar button
String sideBarButtonClass = "v-grid-sidebar-button";
// class for the sidebar content which gets created when the button is clicked
String sideBarContentClass = "v-grid-sidebar-content";
// xpath to select the item corresponding to the necessary column
// there are perhaps more "elegant" solutions, but this is what I came up with at the time
String columnMenuItemXpath = "//*[contains(#class, 'column-hiding-toggle')]/span/div[text()='Name']";
// open the browser
getDriver().get("http://localhost:8080/");
// get the first available grid
GridElement firstGrid = $(GridElement.class).first();
// look for the grid's sidebar button and click it
firstGrid.findElement((By.className(sideBarButtonClass))).click();
// the sidebar content is created outside the grid structure so don't look for it using the grid search context
WebElement sidebarContent = findElement(By.className(sideBarContentClass));
// look for the expected column name and click it
sidebarContent.findElement(By.xpath(columnMenuItemXpath)).click();
}
}
And of course what it looks like in action

Copy layer-style(effect) with settings

i am writing a script for photoshop and I´m looking for a way to copy a layer-style from one layer to another. The applied layerstyle can vary so I must be able to look for any possible style and copy it. I found some code to copy a layer style but the settings won´t be copied. Using the script listener does not help me much because it´s all hardcoded..
Is there a way to also copy the settings of a style? And a way to do this for all possible styles?
It is my understanding that Adobe does not have any methods for retrieving styles or style properties in the scripting interface. Apparently though, this can be done manually through Action Manager code. This post in the Adobe forums discuss some of the ways to go about doing that: How to get the style of a layer using Photoshop Scripting ?
I Haven't tested this but this maybe what you are looking for:
if (app.documents.length > 0 && app.activeDocument.layers.length > 1) {
transferEffects(app.activeDocument.layers.getByName("styleLayer"), app.activeDocument.activeLayer);
};
// function to copy layer effects of one layer and apply them to another one
function transferEffects(layer1, layer2) {
app.activeDocument.activeLayer = layer1;
try {
var id157 = charIDToTypeID("CpFX");
executeAction(id157, undefined, DialogModes.ALL);
app.activeDocument.activeLayer = layer2;
var id158 = charIDToTypeID("PaFX");
executeAction(id158, undefined, DialogModes.ALL);
} catch (e) {
alert("the layer has no effects");
app.activeDocument.activeLayer = layer2;
}
};

Create code with content_tag without indentation

I'm trying to insert a code snippet into my page using the content_tag function. Below is a sample of my code
src_code = 'my code ...'
content_tag :pre do
content_tag :code do
src_code
end
end
Where the src_code variable is storing this string:
#include <stdio.h>
int main(void) {
do some stuff...
}
After running, this code outputs the following markup:
<pre><code>#include <stdio.h>
int main(void) {
do some stuff...
}
</code></pre>
The problem is that the second line right after the opening tags has an extra level of indentation. The original code snippet only has one tab indent inside of the main function.
This is what I see in my browser:
#include <stdio.h>
int main(void) {
do some stuff...
}
Everything, except for the first line, has an extra level of indentation. How can I stop the content_tag function from adding that extra indentation?
After much searching and testing I finally figured out the problem. The issue was not how include_tag was generating the markup, it was working just fine. The problem was when Haml rendered the rest of the page it was adding extra tabs to the markup. This SO question then helped resolve my issue. by simply calling preserve before rendering my content the spacing and new lines where kept intact.

Insert an HTML heading on each pages in a while PHP for print

My question is a bit hard to explain but there I go..
I have a document generated in a WHILE (php) from a MySQL request and it does ~ 10 pages when I press Ctrl+P.
Demo source : http://3ansdemulti.com/dev/print.htm
As you can see, I would like to know if it is possible to configure dynamics pages with the HEADER on top of each PRINT page..
I know I can use the page-break-before on the element but how could I know how to determine where the page should break?
If you need more information, just ask me! I am open to discussions.
Use fPDF....
<?php
require('fpdf.php');
class PDF extends FPDF
{
// Page header
function Header()
{
// Logo
$this->Image('logo.png',10,6,30);
// Arial bold 15
$this->SetFont('Arial','B',15);
// Move to the right
$this->Cell(80);
// Title
$this->Cell(30,10,'Title',1,0,'C');
// Line break
$this->Ln(20);
}
// Page footer
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','I',8);
// Page number
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
//YOUR LOOP GOES HERE AND DEPENDING ON HOW MANY ITEMS FIT ON A PAGE,
//YOU ADD NEW PAGE...AND CALL THE HEADER AND FOOTER EACH TIME....
//DOCUMENTATION CAN BE FOUND ON THE SITE...
?>
www.fpdf.org
Just download the library and give it a go, it's the way better option for printable/emailable documents.

Resources