TableView SectionIndexTitles margin - xamarin

How to set SectionIndexTitles after cell and header.
Like this UI.
It's currently looking like
I have tried to apply content Inset but when click on indextitle inset become 0 and left side also cut cell . How to resolve it ?
ContactsTableView.ContentInset = new UIEdgeInsets(0, -15, 0 , 0);

Related

CATScript - Text, Lines and Frames in Black

The code is as below (CATScript):
Sub CATMain()
' enter sheet background
Set oView = oDrawingDocument.DrawingRoot.ActiveSheet.Views.Item("Background View")
oView.Activate
' select all views in current screen
Set oSelection = oDrawingDocument.Selection
oSelection.Search "Type=*,scr"
' set visual to black
oSelection.VisProperties.SetRealColor 0, 0, 0, 0
' exit sheet background
Set oView = oDrawingDocument.DrawingRoot.ActiveSheet.Views.Item("Main View")
oView.Activate
End Sub
The code works seamlessly except that oSelection.VisProperties.SetRealColor 255, 255, 255, 0 does not change any of the selected lines and frames to black in my 2D drawing. Manually I can do this so pretty sure I'm just using the wrong syntax. SetVisibleColor neither works, but then also I can only find that these syntaxes are used for changing color in 3D and I am using it for a 2D drawing. Anyone here knows the syntax to manipulate the color icon in the 'Graphic Properties' workspace for a 2D drawing?
This is the solution I found after some research and trial&error:
'CHANGE LINE COLOR
Set oSelectionGI = oDrawingDocument.Selection
oSelectionGI.Search("CATDrwSearch.CATEarlyGenItem,all")
oSelectionGI.VisProperties.SetRealColor 0,0,0,0
'CHANGE TEXT COLOR
Set oSelectionDC = oDrawingDocument.Selection
oSelectionDC.Search("CATDrwSearch.DrwText,all")
oSelectionDC.VisProperties.SetRealColor 0,0,0,0
'CHANGE TABLE COLOR
Set oSelectionDT = oDrawingDocument.Selection
oSelectionDT.Search("CATDrwSearch.DrwTable,all")
oSelectionDT.VisProperties.SetRealColor 0,0,0,0

Sub 10 height request layouts/views not allowed

I'm trying to add line dividers between views. However, there is a forced margin on every element I try (Image, BoxView, Frame, Label). I set the margin to be 0, the HeightRequest is always 3, but as you can see the view bounds expand past the actual view. Is there a specific view I'm supposed to be using? I just want the gray line and nothing more.
var line2 = new Frame
{
WidthRequest = (App.ScreenDpWidth / 2),
MinimumHeightRequest = 3,
HeightRequest = 3,
BackgroundColor = Color.FromHex("#229EBB"),
Margin = new Thickness(0, 0)
};
I assume you are layouting your elements either in a Grid or a StackLayout.
By default, the StackLayout.Spacing, Grid.RowSpacing and Grid.ColumnSpacing properties are set to 6d.
Without more information, I think that's what you're seeing in your code. Change those values to 0d.
Also, if you only want a gray line, you can use a BoxView which will draw a gray box, and set it's Height to 1d.

Paint a border around every image in a Word document

Is there a way to add a border around every image in Word? I know that I can create a custom paragraph style with a border and put the image in there, but maybe I can just specify a global image style, like in CSS:
img { border: 1px solid #000 }
Unfortunately, there is no picture style concept available in Word. Therefore, something like specifying a global style for images similar to CSS is not possible.
What you can do is write a VBA macro that adds the border to all images. The code is a little different depending on whether your image is formatted to be inline with text (InlineShape) or floating (Shape):
Sub AddBorderToPictures()
' Add border to pictures that are "inline with text"
Dim oInlineShape As inlineShape
For Each oInlineShape In ActiveDocument.InlineShapes
oInlineShape.Borders.Enable = True
oInlineShape.Borders.OutsideColor = wdColorBlack
oInlineShape.Borders.OutsideLineWidth = wdLineWidth100pt
oInlineShape.Borders.OutsideLineStyle = wdLineStyleSingle
Next
' Add border to pictures that are floating
Dim oShape As shape
For Each oShape In ActiveDocument.Shapes
oShape.Line.ForeColor.RGB = RGB(0, 0, 0)
oShape.Line.Weight = 1
oShape.Line.DashStyle = msoLineSolid
Next
End Sub
If apparently setting the line width to wdLineWidth100pt is an issue, you can try using the actual underlying integer value instead, e.g.:
oInlineShape.Borders.OutsideLineWidth = 8
This is how the constant is defined:
public enum WdLineWidth
{
wdLineWidth025pt = 2,
wdLineWidth050pt = 4,
wdLineWidth075pt = 6,
wdLineWidth100pt = 8,
wdLineWidth150pt = 12,
wdLineWidth225pt = 18,
wdLineWidth300pt = 24,
wdLineWidth450pt = 36,
wdLineWidth600pt = 48,
}

Horizontal scrollView/UIImageView layout issue

The goal: Have a scroll view that displays an array of uiimageviews (photos) that you can horizontally scroll through them
How I understand to do this: Make the frame (CGRect) of each uiimageview the height and width of the scroll view, the y value to 0 on each, and set the first imgViews x value to 0. For every imgView after that, add the width of the scrollview to the x value. In theory, this would line the imgViews (Photos) up next to each other horizontally and not allow for any vertical scrolling or zooming, purely a horizontal photo viewer.
The storyboard setup: I am creating my scrollview in a xib file (It’s a custom uiCollectionViewCell), with these constraints:
— Top space to cell (0)
— Trailing space to cell (0)
— Leading space to cell (0)
— Height of 400
— Bottom space to a view (0)
—— (See Below for img)
Laying out the UIImgViews:
func layoutScrollView() {
for (index, img) in currentImages.enumerate() {
let imgView = UIImageView(frame: CGRect(x: CGFloat(index) * scrollView.bounds.width, y: CGFloat(0), width: scrollView.bounds.width, height: scrollView.bounds.height))
imgView.contentMode = .ScaleAspectFill
imgView.image = img
scrollView.addSubview(imgView)
scrollView.contentSize = CGSize(width: imgView.frame.width * CGFloat(index), height: scrollView.bounds.height)
scrollView.setNeedsLayout()
}
}
My suspicion: I suspect the issue is stemming from the auto layout constraints i’ve specified, but (considering Im asking a SO question) not sure
If there is a better way to do this (really the correct way) please let me know! I have been trying to wrap my head around this for a few days now.
I appreciate all responses! Thanks for reading
EDIT #1
I tried paulvs approach of setting setNeedsLayout & layoutIfNeeded before the "for" loop, and still no luck. Here is (out of three images selected) the second photo displaying. It seems that both the first and second photos are way longer than the content view and that would move the middle view over (Squished).
Your code looks fine except for a few details (that may be causing the problem):
Add:
view.setNeedsLayout()
view.layoutIfNeeded()
before accessing the scrollView's frame (a good place would be before the for-loop).
This is because when using Autolayout, if you access a view's frame before the layout engine has performed a pass, you will get incorrect frames sizes/positions.
Remove these lines from inside the for-loop:
scrollView.contentSize = CGSize(width: imgView.frame.width * CGFloat(index), height: scrollView.bounds.height)
scrollView.setNeedsLayout()
and place this line after (outside) the for loop:
scrollView.contentSize = CGSize(width: imgView.frame.width * CGFloat(currentImages.count), height: scrollView.bounds.height)

JavaFX8 - Remove highlighting of selected row

When I click on a row within a TableView the row will be highlighted blue. How is it possible to disable this feature?
I've already tried to set the background to white, but the problem is that the row-color isn't white in every row.
Does anybody know what to do?
best regards
EDIT:
In the image below you see the blue color of the second row. This highlighting should be removed.
If you really want to do this (I agree with #kleopatra in the comments that it would make life difficult for the user) you can revert the colors for selected rows with an external css file:
.table-row-cell:filled:selected {
-fx-background: -fx-control-inner-background ;
-fx-background-color: -fx-table-cell-border-color, -fx-background ;
-fx-background-insets: 0, 0 0 1 0 ;
-fx-table-cell-border-color: derive(-fx-color, 5%);
}
.table-row-cell:odd:filled:selected {
-fx-background: -fx-control-inner-background-alt ;
}

Resources