I am trying to set a toolbar button image. I have found various ways of defining button images, but none seem to work consistently.
Here are the ways I have found (either in documentation or on SO):
In code (doesn't work at all for me [for toolbar buttons])
public PXAction<DAC> action;
[PXButton(CommitChanges = true, ImageKey = PX.Web.UI.Sprite.Main.ArrowRight)]
[PXUIField(DisplayName = "Action")]
protected virtual void Action()
In ASPX, in Base Properties > Images > Normal of the screen editor
Normal | main#ArrowRight
In ASPX, in Ext Properties > ImageKey and ImageSet of the screen editor
ImageKey | main
ImageSet | ArrowRight
The ASPX options work for the main ArrowRight icon, but there are various other icons in the same sprite that I would like to use that do NOT work. For instance, intellisense in VS suggests that Relation and RelationF are also in the main sprite, but these display as blank images.
What am I doing wrong, and how can I access something other than arrows?
The web font is contained in the fonts folder of the Acumatica web site on the web server. Install a local Acumatica web site if necessary.
Font folder example: C:\AcumaticaSites\YourWebsite\fonts
Open one of the fonts file. The file acumatica-font-v1.svg can be opened in a text editor.
You will notice Relation / RelationF are missing and main-ArrowRight is declared in the file:
<glyph unicode="" glyph-name="main-ArrowRight, ac-arrow_forward" d="M448 134.4l262.4 262.4h-582.4v96h582.4l-262.4 275.2 64 64 384-384-384-384-64 70.4z" />
Check the mapping between the constant and the Unicode icon in Content\font-awesome.css CSS file:
.main-ArrowRight:before {
content: "\e90a";
}
You can also open the true type font ttf from the fonts folder and install it to view the icons in a font viewer.
Related
A bit of context:
I was looking into the Material Design Support Library for Xamarin and found this article about various controls from this library.
I tried to reproduce the Toolbar from the last example (for now I'm not even thinking about implementing the whole hamburger navigation example, just the toolbar with the button). I set it up, created MyTheme with my colors, added the fixes for style-v21 and so on. Everything works well so far, though the <include ... /> node throws a warning that it's not a recognized child for RelativeLayout. Still, it's building correctly so I can deal with it for the most part.
The problem:
Here's where my problem starts:
...
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.main_layout);
var toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
SetSupportActionBar (toolbar);
//Enable support action bar to display hamburger
SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_menu);
SupportActionBar.SetDisplayHomeAsUpEnabled (true);
...
With the SupportActionBar set up like that, it doesn't display the button. Also, the ic_menu drawable seems to be missing. In fact, there aren't any that start with ic_, only abc_.
Am I missing something here?
Cheers!
Go to https://material.io/icons/ and download menu icon and then add that icon to the drawable folder and then replace ic_menu in your code with the image name.
NOTE: Do not add image extension name like .jpg,.png with image name
I need convert the image that is in String or Byte to Icon to show in ToolbarItems.
I need show the photo from user in right side from menu of the app.
My code until now:
this.ToolbarItems.Add(new ToolbarItem("name", "icon", () =>
{
}, ToolbarItemOrder.Primary));
If i set an icon from project, him show me like this:
It seems that ToolbarItem in Xamarin.Forms can only use local files (app resources).
See the API documenation - the property is a FileImageSource, which can only take a local file path.
I have a pdf file created with itextsharp with images in the file. I would like to put a hyperlink in the file that if you pick the picture it will open that picture in a picture viewer. I can set a hyperlink to a web address but have no idea how to get it to open a file. Below is the code, yes I know that c:\test.jpg is a bad hardcoded file name but it is just a test. When you click the picture it does nothing but I have no idea how to tell it what to do.
iTextSharp.text.Image pic =TextSharp.text.Image.GetInstance(comment.examplePic);
pic.ScaleToFit(200f, 200f);
Chunk cImage = new Chunk(pic, 0, 0, false);
Anchor anchor = new Anchor(cImage);
anchor.Reference = "c:\\test.jpg";
doc.Add(pic);
doc.Add(anchor);
A PDF is self-contained. This means that all the resources needed to show the PDF are (usually) stored inside the PDF (exceptions are for instance fonts that can be retrieved from the operating system).
When you have an image that is shown on a PDF page, the bytes of that image are stored in what we call an Image XObject. An XObject is an object that is external to the page, but that is stored as a separate object inside the PDF file.
You are asking to serve the image bytes stored inside this separate object to a viewer on the operating system. This is impossible. I don't know of any viewer that can take those bytes and somehow forward them to an image viewer.
I can think of three possible workarounds. I don't know if any of these workarounds is acceptable to you.
1. Serve the image online
You could put the image on a server and use the code you have in your snippet to link to that online image. Of course: this will only work if the person viewing the document is online and clicks OK when his viewer asks him if it's OK to link to a resources on the internet.
2. Serve the image as an annotation
In this case, you create an annotation for which you create an appearance that renders that same image XObject in the annotation layer (all annotations are shown on top of the page content). You can easily change the visibility status of an annotation to make it invisible (in your case, this would be the default status) or visible (in your case, this would be triggered by a JavaScript action when clicking the link).
There's an example of such an annotation here: Advertisement. If you open advertisement.pdf, you see an image with a button that says "Close this advertisement". Once you click that, the status of the annotation will be changed to invisible. You could do something similar, but the other way round: click a link to make it visible instead of invisible.
This solution doesn't depend on an external viewer, the image is shown in the PDF viewer.
3. Add the image as optional content
Starting with PDF 1.5, PDF supports optional content. See for instance the OptionalContentExample. In this example, we have some questions and answers, but the answers are not visible by default. See layer_actions.pdf. There are links "on / off / toggle" to make the answers visible or invisible.
You could do the same with images: you could add them to a layer that is invisible by default, but that can be made visible if somebody clicks a link. However: this requires a viewer that supports OCG (optional content groups) and the actions to change the status of these OCGs. For instance: if you would try the layer_actions.pdf example in the PDF viewer in Chrome, it won't work, but if you download the PDF and open it in Adobe Reader, you'll see the behavior I described.
Summarized:
You are asking something that is impossible, but there are workarounds. Please post another question if you have chosen a workaround and you don't succeed in making that workaround word (but please take into account that not all viewers support every workaround).
no offence but too much knowledge sometimes makes you ignorant of small things.
simple solution to this problem is here
http://kuujinbo.info/iTextSharp/imageAnchor.aspx
sample code that i implemented works like charm
PdfPCell p1 = new PdfPCell();
p1 = new PdfPCell();
p1.Padding = 0;
p1.Border = 0;
PdfPTable nav = new PdfPTable(1);
nav.WidthPercentage = 100;
nav.SpacingAfter = 12;
navbarImg.Annotation= new Annotation(0, 0, 0, 0, ur);
p1.Image = navbarImg;
nav.AddCell(p1);
_doc.Add(nav);
I have just purchased: http://www.add-in-express.com/outlook-regions/
The reason why I have purchased that product is because I need to show a custom form on the main view of outlook when a specific folder is selected. I have managed to do so by doing the following:
Create a new Project int visual studio of type (Outlook 2010 Add-in)
Once that project is created I add:
Because I want that form to show on the main folder view of mail (replace all other views) I select this option:
I click next and follow all the defaults in order to create the form.
Once that form is created I add the buttons and images I need. In this example I will just add a button.
when I then run outlook and select my inbox folder this is what shows up:
(In other words every time I select a folder of type olMailItem that form shows up)
So now I solve my goal to display my custom form on the "main view of outlook"
Now my question is how can I show that form only on specific folders. For example I do not want to show that form when the folder "Inbox" is selected but I do want to show it when the folder "Outbox" is selected for example
Let's try to hide the form and show the default view when the button is clicked.
In order to solve that problem I have looked at: http://www.add-in-express.com/forum/read.php?FID=5&TID=4540
I have done the same steps but the form shows up again! In other words the code behind of the button looks like:
private void button1_Click(object sender, EventArgs e)
{
// get current folder in this case its inbox the one that is selected
MAPIFolder currentFolder = Globals.ThisAddIn.Application.ActiveExplorer().CurrentFolder;
Globals.ThisAddIn.ADXOlForm1Item.FolderName = string.Empty;
// clear web properties DO NOT SHOW WEB VIEW
currentFolder.WebViewURL = string.Empty;
currentFolder.WebViewOn = false;
// RESET FOLDER BY SELECTING A DIFFERENT ONE THEN THE SAME ONE
NameSpace nameSpace = Globals.ThisAddIn.Application.GetNamespace("MAPI");
MAPIFolder outboxFolder = nameSpace.GetDefaultFolder(OlDefaultFolders.olFolderOutbox);
Globals.ThisAddIn.Application.ActiveExplorer().CurrentFolder = outboxFolder; // CHANGE FOLDER TO A DIFFERNT ONE
System.Windows.Forms.Application.DoEvents();
Globals.ThisAddIn.Application.ActiveExplorer().CurrentFolder = currentFolder; // SET INBOX AGAIN
}
when I run that code the default view shows up for 1 second then it get's replaced with the form!
-------------------------------------------Edit-------------------------------------------
When I add the form region Addin Express adds a ADXOlFormsManager and a ADXOlFormsCollectionItem for the form that I created. Based on your answer I have done:
#region ADXOlForm1
// TODO: Use the ADXOlForm1Item properties to configure the region's location, appearance and behavior.
// See the "The UI Mechanics" chapter of the Add-in Express Developer's Guide for more information.
ADXOlForm1Item = new ADXOlFormsCollectionItem();
ADXOlForm1Item.FolderName = "MyCustomFolder"; // <---- ADDED THIS LINE HOPING TO SHOW THIS FORM ONLY WHEN THAT FOLDER IS SELECTED
ADXOlForm1Item.ExplorerLayout = ADXOlExplorerLayout.WebViewPane;
ADXOlForm1Item.ExplorerItemTypes = ADXOlExplorerItemTypes.olMailItem;
ADXOlForm1Item.UseOfficeThemeForBackground = true;
ADXOlForm1Item.FormClassName = typeof(ADXOlForm1).FullName;
this.FormsManager.Items.Add(ADXOlForm1Item);
#endregion
I was hoping for that form to only show up in MyCustomFolder but it does shows up when selecting any folder of type ADXOlExplorerItemTypes.olMailItem. Perhaps I am doing something wrong....
In other words I was hoping for only the MAPIFolder MyCustomFolder folder had the properties
WebViewOn=true;
WebViewURL = "...AppData\Local\Temp\AddinExpress\ADXOlFormGeneral.html"
but as I traverse all the folders in outlook I can see that all of them have those properties even after specifying ADXOlForm1Item.FolderName = "MyCustomFolder";
Thank you for choosing Add-in Express Regions.
I understand the "main view of outlook" as the folder that Outlook shows when it is started. By default, that folder is the top-level folder of the message store. Note that this can be changed, see File | Options | Advanced | Start Outlook in this folder. I use this setting so that my Outlook shows me the Inbox at start-up.
The below is a citation from the section Context-Sensitivity of Your Outlook Form, see see the PDF file in the folder {Add-in Express}\Docs\ on your development PC:
ADXOlFormsCollectionItem provides a number of properties that allow specifying the context settings for your form. Say, you can specify item types for which your form will be shown. Note that in case of explorer, the item types that you specify are compared with the default item type of the current folder. In addition, you can specify the names of the folders for which your form will be shown in the FolderName and FolderNames properties; these properties also work for Inspector windows – in this case, the parent folder of the Outlook item is checked. An example of the folder path is "\Personal Folders\Inbox".
A special value in FolderName is an asterisk ('*'), which means "all folders". You can also specify message class(es) for which your form will be shown. Note that all context-sensitivity properties of an ADXOlFormsCollectionItem are processed using the OR Boolean operation. That is, specifying e.g. folder names extends, but not limits, the list of contexts for which your form will be shown.
That is, if you need to show the form for a given folder, specify the path to that folder in the FolderName/*FolderNames* property.
Regards from Belarus (GMT+3),
Andrei Smolin, Add-in Express Team Leader
I need to change the background image at runtime, based on which RadioButton the user clicks. I'm doing this in a WPF project in Visual Studio, and I need to put the code in the Checked event in the xaml.cs file
I have an Image control called imgBackground, with 6 images in its Source collection, which are listed in an Images folder in the Solution Explorer.
I've tried:
this.imgBackground.Source = "filename.jpg";
both with and without the quotes, and with various paths (I've tried too many different variations to list them all here) and nothing works - everything I've tried just gives an error in the editor, before I even try to build and run anything (the error given varies depending on what I'm trying at the time).
If you are using relative paths as filenames like
this.imgBackground.Source = "filename.jpg";
then these files must be in the same directory as the .exe of your program is.
One workaround would be to use absolute paths like
this.imgBackground.Source = #"C:\MyFolder\MyProject\filename.jpg";
Or, even further use the packaging mechanism of WPF or pack your images as resources into your assembly. Look at this thread.
EDIT:
For your clarification:
The Source-property demands an System.Windows.Media.ImageSource-object, which you must provide.
Do it like this:
BitmapImage bi3 = new BitmapImage();
bi3.BeginInit();
bi3.UriSource = new Uri("filename.jpg", UriKind.Relative);
bi3.EndInit();
this.imgBackground.Source = bi3;
Please refer to this documentation here.