List view with tile view style, sub item does not appear? - api

I'm working on ListView with pure win32 api. But when I set ListView with tile view. then the sub item does not appear beside item.
My code below:
ListView_SetView(m_hwndListview,LV_VIEW_TILE);
//Set tile view info
SIZE size = { 150, 75 };
LVTILEVIEWINFO tileViewInfo = {0};
tileViewInfo.cbSize = sizeof(tileViewInfo);
tileViewInfo.dwFlags = LVTVIF_FIXEDSIZE;
tileViewInfo.dwMask = LVTVIM_COLUMNS | LVTVIM_TILESIZE;
tileViewInfo.cLines = 3;
tileViewInfo.sizeTile = size;
//Set tile info
LVTILEINFO lvti = {0};
int order[2];
order[0]=2;
order[1]=1;
lvti.cbSize = sizeof(LVTILEINFO);
lvti.iItem = 0;
lvti.cColumns = 2;
lvti.piColFmt = LVCFMT_LEFT;
lvti.puColumns = PUINT(order);
ListView_SetTileInfo(m_hwndListview, &lvti);
ListView_SetTileViewInfo(m_hwndListview, &tileViewInfo);
Does anyone have idea to solve this problem?
Thanks so much!

lvti.piColFmt should be a pointer to an array of column format values, not a single value. In your case it could be something like this:
int colfmt[2];
colfmt[0] = LVCFMT_LEFT;
colfmt[1] = LVCFMT_LEFT;
lvti.piColFmt = colfmt;
Hope that helps!

Related

Oxyplot - LineAnnotion text display horizontally

I use C# and Oxyplot.
I have a LineAnnotation to which I want to add a text.
So I have set Text Property for the LineAnnotation, but the text is vertical aligned.
How could I add a text (1..3 lines) to a LineAnnotation and that texts shows horizontally, so that users can read it ?
Not good :
What I would like:
LineAnnotation Markerline = new LineAnnotation();
Markerline.Color = OxyColors.Blue;
Markerline.LineStyle = LineStyle.Solid;
Markerline.StrokeThickness = 5;
Markerline.Type = LineAnnotationType.Vertical;
Markerline.XAxisKey = "x1";
Markerline.YAxisKey = yAxisKey;
Markerline.Tag = "Marker";
Markerline.Text = "Hello World"; //how to display on top of Markerline horizontally ?
Just set the LineAnnotationType:
Markerline.Type = LineAnnotationType.Horizontal;
You need to LineAnnotation.TextOrientation property. For example,
Markerline.TextOrientation = AnnotationTextOrientation.Horizontal;
In addition, you could also set the LineAnnotation.TextHorizontalAlingment Property to dictate on the position of Text with respect to the Line Annotation.
Markerline.TextHorizontalAlignment = HorizontalAlignment.Left;

display data labels column stacked epplus

I have a stacked column report and i need to show the label value inside each of the series, is this possible. here is the code i have so far. It does look like barcharts have this option, not sure if i need to convert report to that type.
chart.Title.Text = "Total Pipeline - Initiative Count by Release";
chart.Title.Font.Size = 8;
chart.SetPosition(45, 0, 3, 0);
chart.SetSize(400, 300);
chart.Legend.Add();
chart.YAxis.MajorUnit = 10;
var series1 = chart.Series.Add(Chartsheet.Cells["L23:Q23"], Chartsheet.Cells["L22:Q22"]);
series1.HeaderAddress = new ExcelAddress("'Graphs'!K23");
var series2 = chart.Series.Add(Chartsheet.Cells["L24:Q24"], Chartsheet.Cells["L22:Q22"]);
series2.HeaderAddress = new ExcelAddress("'Graphs'!K24");
chart.Legend.Position = eLegendPosition.Bottom;
chart.YAxis.LabelPosition = eTickLabelPosition.NextTo;
chart.XAxis.MajorTickMark = eAxisTickMark.Out;
chart.XAxis.MinorTickMark = eAxisTickMark.None;
chart.ShowDataLabelsOverMaximum = true;
so i just forced a format of a barchart and i have the label option
var chart = (OfficeOpenXml.Drawing.Chart.ExcelBarChart) Chartsheet.Drawings.AddChart("chart", eChartType.ColumnStacked);

Corona SQL pass row ID in tableView to new Scene

I've found a similair question to my problem and so far its working for me, Im getting the row ID printed with a print statement.
I am displaying data from my Database in a tableView. With the onTouch function I want the data showed in a new Scene in a scrollView that gets that data specifically to that clicked row. So for example I am clikcing on the tableView on Capital_NL, it has to show Amsterdam in the scrollView (Scene 2).
This is my code so far:
Scene 1:
local count = 0
local baslikRow = {}
for row in db:nrows("SELECT dua_id, baslik FROM dua") do
count = count + 1
baslikRow[count] = {}
baslikRow[count].baslik = row.baslik
baslikRow[count].dua_id = row.dua_id
end
local function tableViewListener( event )
print(event.phase)
end
local function onRowRender( event )
local row = event.row
local rowHeight = row.contentHeight
local rowWidth = row.contentWidth
local options =
{
parent = row,
text = baslikRow[row.index].baslik,
x = 20,
y = 0,
font = native.systemFont,
fontSize = 16
}
local rowTitle = display.newText(options)
rowTitle:setFillColor( 0, 0, 0 )
rowTitle.anchorX = 0
rowTitle.x = 15
rowTitle.y = rowHeight * 0.5
end
local function onRowTouch( event )
local row = event.row
if event.phase == 'tap' then
print("Pressed rowNR: " .. row.index )
print("Pressed rowID: " .. event.target.params.paramID)
composer.gotoScene("scene2")
end
end
local tableView = widget.newTableView{
left = 0,
top = 0,
height = display.contentHeight,
width = display.contentWidth,
onRowRender = onRowRender,
onRowTouch = onRowTouch,
}
for i = 1, count do
tableView:insertRow
{
rowHeight = 50,
rowid = baslikRow[count].dua_id,
params = { paramID = baslikRow[i].dua_id }
}
end
sceneGroup:insert(tableView)
Scene 2:
---------------------
-- CREATE SCROLLVIEW
---------------------
local scrollView = widget.newScrollView
{
left = 0,
top = 0,
width = display.contentWidth,
height = display.contentHeight,
topPadding = 0,
bottomPadding = 0,
horiontalScrollDisabled = true,
verticalScrollDisable = false,
listener = scrollListener,
}
sceneGroup:insert(scrollView)
---------------------
-- GET DATA FROM DB
---------------------
for row in db:nrows("SELECT metni FROM dua") do
local rowParams =
{
duaID = row.dua_id,
Metni = row.metni,
}
local options =
{
text = row.metni,
x = display.contentCenterX + 20,
y = display.contentHeight / 2,
width = 300,
width = display.contentWidth,
font = native.systemFontBold,
fontSize = 18,
}
local t = display.newText(options)
t:setTextColor(0)
scrollView:insert(t)
end
What I have right now is, whenever I click on, for example Capital_NL or Capital_USA or Capital_Germany, I always get the result Amsterdam back.
How do I pass the data thats in the same Row in the database from Scene 1 to Scene 2
I think you want to display the (metni) data based on the row number tapped on the previuos scene ..
Try this inside scene1 ..
for row in db:nrows("SELECT dua_id, baslik, metni FROM dua") do
count = count + 1
baslikRow[count] = {}
baslikRow[count].baslik = row.baslik
baslikRow[count].dua_id = row.dua_id
baslikRow[count].metni = row.metni
inside the onRowTouch event handler:
composer.gotoScene("scene2",{params = baslikRow[row.index].metni})
This way you can pass the data you want to use .. I guess you don't need to use the database code inside scene2 ..
to access the data passed from scene1 to scene2
local selectedRow = event.params
Then ..
local options =
{
text = selectedRow,
x = display.contentCenterX + 20,
y = display.contentHeight / 2,
width = 300,
width = display.contentWidth,
font = native.systemFontBold,
fontSize = 50,
}
local t = display.newText(options)
t:setTextColor(0)
scrollView:insert(t)
I think thats what you asked for .. If NOT, please explain more and give us a screenshot of your "dua" table ..

Visualization SPmenuField in SPGridView

I have created SPGridView and added one SPMenuField as the first column and some BoundFields. Then I added MenuTemplate to the first column. But there are rectangles with white color border. I want to hide them. How can I do it ?
Here is the code I use:
SPMenuField colMenu = new SPMenuField();
colMenu.HeaderText = "Title";
colMenu.TextFields = "Title";
colMenu.MenuTemplateId = "TitleListMenu";
colMenu.NavigateUrlFields = "WebId, ListId, ID";
colMenu.NavigateUrlFormat = "default.aspx?WebID={0}&ListID={1}&ListItemID={2}";
colMenu.TokenNameAndValueFields = "Param1=ID";
colMenu.SortExpression = "Title";
MenuTemplate typeListMenu = new MenuTemplate();
typeListMenu.ID = "TitleListMenu";
// ... //
Controls.Add(typeListMenu);
customGridView.Columns.Add(colMenu);
Here is the answer on my question. It is nesseccery to narrow the .ms-menuimagecell css class.

How to add a text on top of a column with ZedGraph?

How can I add some text on top of a bar in a chart.
This is the code I have to add the bar:
var color = ColorTranslator.FromHtml(row.Colour);
var barItem = graphPane.AddBar(row.Propensity.ToString(), null, Ys.ToArray(), color);
Thank you
Here is a quick example using TextObj to simply add labels to each bar.
GraphPane myPane = zedGraphControl1.GraphPane;
double[] y = { 100, 50, 75, 125 };
BarItem myBar = myPane.AddBar("Data", null, y, Color.Red);
for (int i = 0; i < myBar.Points.Count; i++)
{
TextObj barLabel = new TextObj(myBar.Points[i].Y.ToString(), myBar.Points[i].X, myBar.Points[i].Y + 5);
barLabel.FontSpec.Border.IsVisible = false;
myPane.GraphObjList.Add(barLabel);
}
myBar.Label.IsVisible = true;
zedGraphControl1.AxisChange();
zedGraphControl1.Invalidate();
Of course this just uses the value of the data as the label. If you wanted to use custom labels, you could create a string array or list and use that inside the loop.
Here are some ZedGraph references:
Introduction and examples: http://www.codeproject.com/KB/graphics/zedgraph.aspx
Source code documentation: http://zedgraph.sourceforge.net/documentation/default.html
You need to define AlignH and AlignV in your text object:
TextObj textLabel = new TextObj(value.ToString(), positionX, value, CoordType.AxisXYScale, AlignH.Center, AlignV.Top);
AlignV define the position of your value on the bar.
Providing you want the label text to match the value of each bar, then you can do it with a single line of code:
BarItem.CreateBarLabels(graphPane, false, "F0");
Note that the 3rd parameter is a double.ToString format. e.g. "F0" = 12, "F2" = 12.34
However, if you want any flexibity with it then this solution is not ideal. It also doesn't work very well if you have a stacked bar chart, because having any 0 value data will cause labels to overlap and look horrific