Vertical Align in Livecode - vertical-alignment

I want to vertically align the text of the label in livecode like aligning to top, middle, or bottom.
----------------------------------
| top text |
| |
| |
---------------------------------
---------------------------------
| |
| middle text |
| |
---------------------------------
---------------------------------
| |
| |
| bottom text |
---------------------------------
Is there any way to do that? If no, is there an alternate way to do that?

There is no built-in way to automatically position label text as you describe. However, unless you require the text formatting properties of a field, using a button as a label may better serve your needs because of its default ability to automatically center text vertically.
Something like the following should get you most of the way. You can paste the script in the button directly and dispatch "updateMyTextAlignment <value>" to the button with a value of "top", "middle" or "bottom". But assuming you're going to have multiple custom labels in your stack, a better option would be to apply the following as a behavior to all your label buttons.
command updateMyTextAlignment pValue
put effective textSize of me into TS
put effective textHeight of me into TH
switch pValue
case "top"
set topMargin of me to -(height of me) + TS + TH
break
case "middle"
set topMargin of me to 0 -- may need to adjust this amount
break
case "bottom"
set topMargin of me to height of me - TS - TH
end switch
end updateMyTextAlignment

Unfortunately there is no option in the properties window but you can do this with a simple script like
set the topMargin of field theField to (round(((the height of field theField - the formattedHeight of field theField)/2)) + the topMargin of field theField)
Example for top margin
Update:
Easiest example for top margin:
set the topMargin of field theField to 0
and then adjust 0 to whatever value you want from the top, e.g. your font size or so.
for middle I'd use something like
set the topMargin of field theField to (the height of field theField / 2)
and maybe adjust this by factoring the font size in too.

Related

Alternate row colour by data in fields in a spreadsheet

Good Afternoon all,
I've had a search but can't find the answer - please direct me if there is one!
I'm looking to make my spreadsheet have better readability to the user. It requires a lot of manual work outside of the sheet, so the less time strain the spreadsheet is, the better.
I know to to use =mod() in Conditional Formatting but this isn't what I'm looking for
I also know about opening the filter drop down, and clicking one cell, pressing down twice and pressing space bar (rinse and repeat) - but I'm not going to do this over 1000 rows...
Is there a way to alternate the colours from a filtered name in excel?
For example:
+---------------+---------------+--------------+
| Site Code | Site Name | Changed Date |
+---------------+---------------+--------------+
| 000020 | Bobs site | 28/11/18 | <-- colour 1
| 000020 | Bobs site | 26/11/18 | <-- colour 1
| 059201 | Julian's | date | <-- colour 2
| 059201 | Julian's | date | <-- colour 2
| 002237 | etc. 1 | date | <-- colour 1
| 523878 | etc. 2 | date | <-- colour 2
| 523878 | etc. 3 | date | <-- colour 2
+---------------+---------------+--------------+
So rather than by line number, it would be by the name "bobs site" would be one colour, the next in the list would be another colour etc
I would love for this to apply to site code and site name, so when filtering by either, the rows are highlighted correctly.
I can't do this in the =mod() kind of way, as some sites have just one entry, most have 2 and a few can have up to 10
EDIT: Proof of the answer working for future references
Doable with a helper column and Conditional Formatting with COUNTIF and MOD.
In the helper column:
=OR(A2<>A1,B2<>B1)
which returns TRUE or FALSE if the site code or site name has changed (or not) compared to the previous row.
Then 2 conditional formatting rules:
=MOD(COUNTIF($D$2:$D2,TRUE),2)=0
=MOD(COUNTIF($D$2:$D2,TRUE),2)=1
The mixed reference ($D$2:$D2) in the COUNTIF will allow for each separate section to be coloured alternately as the instances of TRUE are successively added up.
One solution; get all uniq values in a seperate column, copy column you want to refer to, paste to new column, remove duplicates.
Then select area with data and start refering those values you want to have that color i conditional formatting.
Edit
With more options use "AND" or "OR"

How to label scatterplot points by name?

I am trying to figure out how to get labels to show on either Google sheets, Excel, or Numbers.
I have information that looks like this
name|x_val|y_val
----------------
a | 1| 1
b | 2| 4
c | 1| 2
Then I would want my final graph to look like this.
4| .(c)
3|
2| .(b)
1| .(a)
|__ __ __ __
0 1 2 3 4
Like why can't I label each of these points with its name? I can only seem to label the value, e.g, (c) would show 4
Is the only solution D3?
Well I did not think this was possible until I went and checked. In some previous version of Excel I could not do this. I am currently using Excel 2013.
This is what you want to do in a scatter plot:
right click on your data point
select "Format Data Labels" (note you may have to add data labels
first)
put a check mark in "Values from Cells"
click on "select range" and select your range of labels you want on the points
UPDATE: Colouring Individual Labels
In order to colour the labels individually use the following steps:
select a label. When you first select, all labels for the series should get a box around them like the graph above.
Select the individual label you are interested in editing. Only the label you have selected should have a box around it like the graph below.
On the right hand side, as shown below, Select "TEXT OPTIONS".
Expand the "TEXT FILL" category if required.
Second from the bottom of the category list is "COLOR", select the colour you want from the pallet.
If you have the entire series selected instead of the individual label, text formatting changes should apply to all labels instead of just one.
None of these worked for me. I'm on a mac using Microsoft 360. I found this which DID work:
This workaround is for Excel 2010 and 2007, it is best for a small number of chart data points.
Click twice on a label to select it.
Click in formula bar.
Type =
Use your mouse to click on a cell that contains the value you want to use.
The formula bar changes to perhaps =Sheet1!$D$3
Repeat step 1 to 5 with remaining data labels.
Simple
For all those who don't have the option in Excel (like me), there is a macro which works and is explained here: https://www.get-digital-help.com/2015/08/03/custom-data-labels-in-x-y-scatter-chart/ Very useful
Another convoluted answer which should technically work and is ok for a small number of data points is to plot all your data points as 1 series in order to get your connecting line. Then plot each point as its own series. Then format data labels to display series name for each of the individual data points.
In short it works ok for a small data set or just key points from a data set.
If using VBA is an option and assuming that you have a table named 'Table1' of the form:
Label|x_val|y_val
----------------
a | 1| 1
b | 2| 4
c | 1| 2
this routine should work:
Sub labelDatapoints()
Dim r As Integer
With ActiveSheet.ChartObjects(1).Chart 'The scatter plot
.SeriesCollection(1).ApplyDataLabels
For r = 1 To Range("Table1[Label]").Rows.Count 'iterate through all data points
.SeriesCollection(1).Points(r).DataLabel.Text = Range("Table1[Label]").Cells(r).Value 'add the custom label to the current datapoint
Next r
End With
End Sub
Modified from https://www.get-digital-help.com/dynamic-data-labels-in-a-chart/

Table Format Report in Acumatica

I want to design a report in table format. I am using Panel and Line Control for now, but it's time consuming to adjust. Is there a better way to do this?
Example:
| column1 | column2 | column3 |
| aaaaa1 | sdf | sdfsdf |
| aaaaa2 | sdf | sdfsdf |
| aaaaa3 | sdf | sdfsdf |
The row background color should be alternating (gray & white).
Your question is a bit ambiguous I am going to assume you mean using the Report designer you would like to generate a report that looks like the image below.
That being said you have two different items you have to accomplish the table layout and the alternating Row color.
For the Table Layout
Unless I am missing something this is the easy part you only need to use the field controls and border settings on the controls to generate the grids. I have added a screen cap of the standard layout for the report above in the designer
For the Alternating Row Color
This is the challenge because without a little but of work it cant be done. What you have to do is using the visible expression create two sets of duplicate controls one placed directly on top of each other. I used the row number to build my expression that looked like
=IIf( $RowNumber % 2 = '0', True, False )
=IIf( $RowNumber % 2 = '0', False, True )
That divides each row number by two and if there is a remainder (Bottom equation) shows it and vise versa for the other set of controls.

bbcode : How to draw a table

Is there any way to draw a table in a forum which uses bb code if [Table] tab is not supported ?
The tags being allowed in the forum are :
[b], [i], [u]
[color]
[size]
[font]
[highlight]
[left], [right], [center]
[indent]
[email]
[url]
[thread]
[post]
[list]
[img]
[quote]
[noparse]
[attach]
Do not think so.
But, depending on your purpose, it may be sufficient to force a monotype font (e.g. Courier) using the [font] tag, and then simply "draw" your table by hand using ASCII characters. For example:
[font=courier]
-----------------
| Col A | Col B |
-----------------
| 1 | X |
| 2 | Y |
| 3 | Z |
-----------------
[/font]
Certainly, it is troublesome and may be considered dirty, but your set of available tools is pretty limited.
The [code][/code] tag will maintain white spacing. Example at
http://www.bbcode.org/examples/?id=15. I can see that [code] tags may not be allowed in your forum but are they truly disabled? If so, is there any possibility of turning them on?
Alternatively, I would try Wojciech Żółtak's idea to use a monospaced font.
Finally, you could take a screen cap of the table and insert it as an image. Include the table text as part of the image's alt and/or title tag.

Crystal Reports: Text field flow justified around image/margin indentation

I'm creating a report that outputs a letter. The first page contains is a large left margin containing static company information. The letter output can be multiple pages, however I only want the text on the first page indented to the right away from the left margin. How can I accomplish this with one text field (the letter body is all one data field)?
Example: http://i.stack.imgur.com/E6SGr.jpg
Right-click on your text field and select 'Size & Position'. Here you can set the X and Y positions of the field, and the X value can be set conditionally. All you have to do is something like:
if pagenumber=1 then 0 else 1440
Watch out, though, the units used in the formula are twips, not the units listed as your default in the Size & Position window. FYI, 1440 twips to an inch or 20 twips to a point.

Resources