I am trying to specify sidemenu width with the follow code:
Hashtable<String, Integer> h = new Hashtable<>();
h.put("sideMenuSizePortraitInt", 50);
h.put("sideMenuSizeLandscapeInt", 30);
UIManager.getInstance().setThemeProps(h);
But the result has some misplacement, please see the picture. Anybody knows how to fix this?
screenshot
That's a bad idea. This will break your theme entirely as it will replace all existing theming in the app. Theme constants are added in the designer tool by double clicking the res file, selecting the theme and then going to the 5th tab for the constants.
If you insist on doing this thru code I suggest using addThemeProps and not setThemeProps. Theme constants start with the # symbol to signify that they are constants.
Related
I've a textArea with grow limit "2" and alignment "center". I need to hightlight the "Quick Booking" text of the following textArea differently ie. in color, size etc. Since the textArea is aligned center, this hightlighted text may appear anywhere as per the device width. How can I do that?
TextArea ta = new TextArea("Need urgent fix for your car ? We will get to you asap Quick Booking");
ta.setUIID("small");
ta.setEditable(false);
ta.setGrowByContent(true);
ta.setGrowLimit(2);
ta.getAllStyles().setAlignment(Label.CENTER);
How It is now...
How it should be...
That isn't supported. One option is to use a BrowserComponent for this element and format it with HTML. Another is to use a rich text view such as this: https://www.codenameone.com/blog/tip-lightweight-rich-text-view.html
I saw the stack question where it was solved. I didn't find it now otherwise I'd have shared the link. It works though.
homeContainer.add(FlowLayout.encloseCenter(lbl1, new Label("urgent"), new Label("fix"), new Label(" for"), new Label("your"), new Label("car? "), new Label("We"), new Label("will"), new Label("get"), new Label("to"), new Label("you"), new Label("asap "), clickable));
I am afraid this is not supported.I would suggest you to give a look on below article
https://medium.com/#Cuong.Le/android-rich-text-overview-397e6af529d9
I'm using WPF, and I have a RichTextBox in my user interface, which I convert to a PDF file. I take the RichTextBox.Document FlowDocument from the RichTextBox and translate it to a PdfSharp.Pdf.PdfPage.
This has been working pretty good (after finding some help for wordwrap on SO), but I found that I need to scale the PDF, so after I get the font from the FlowDoc, I multiply it by a scale factor, in my case 0.88.
This appeared to work great, but on closer inspection, I found that a few lines were terminating early.
// these lines use font info from the FlowDoc. To simplify, I've
// hard-coded the font size.
// this works fine:
var thisRunXFont = new XFont(thisRun.FontFamily.Source, 14, xRunFontStyle);
// this causes problems:
var thisRunXFont = new XFont(thisRun.FontFamily.Source, 12.32, xRunFontStyle);
Has anyone else seen this kind of trouble? I do go on to use MeasureString() to get the enclosing paragraph -- but forcing the rectangle to be wider does not change the behavior.
I am using CategoryPointerAnnotation to draw an arrow and show label. Right now the label seems to be too wide. Is it possible to add a line break so that that $ amount shows up on the next line?
CategoryPointerAnnotation ann5 = new CategoryPointerAnnotation("You are here $" +
NumberFormat.getIntegerInstance().format(
num.intValue()), cat, num.intValue(), -2.35619449);
No, line-breaks are not supported. Neither in title, subtitles, labels, tooltips, etc. You can search the JFreeChart forum for "linebreak" or "newline" to find related posts. There have been featuers-requests and according to the forum there were even patches available to fix this, but none has made it into JFreeChart yet (as of 1.0.19).
Have you tried adding in System.getProperty("line.separator")?
I come from Java background, where we have data structures with interfaces that if its collection it support certain behaviour, and a set has another.
while programming in Delphi I thed to hit a brick wall when it comes in asking the reflection about the behaviour of items, its very strange.
for example this code does not compile
menuOfSomeKind.Items.Add(t);
where menu of some kind is a component that has Items that contain other sub components, that are the menu entries.
if I want to dynamically edit this, meaning using the add behaviour, it says '[' expected but '.' found.
Could you please clarify this?
Probably menuOfSomeKind is TMenuItem and not TMainMenu
If you are adding an item to TMenuItem use MenuItem.Add(t);
If you are adding an item to TMainMenu use MainMenu.Items.Add(t);
There's a difference between TMainMenu/TMenu and TMenuItem.
var
mainMenu: TMainMenu;
menu: TMenu;
subMenu: TMenuItem;
begin
//***** This creates a new root menu
mainMenu.Items.Add(TMenuItem.Create);
//***** Essentially the same as mainMenu
menu.Items.Add(TMenuItem.Create)
//***** This adds a new submenu to an existing menu
subMenu.Add(TMenuItem.Create);
//***** This adds a new submenu to the first submenu of an existing menu
subMenu.Items[0].Add(TMenuItem.Create);
end;
Note that presented code compiles but will throw exceptions all over the place when run. For starters, none of the local variables are assigned.
in my Surface application happens this:
When I put an IdentityTag onto my TagVisualizer, a white cross-hair appears. This TagVisualizer adds no TagVisualization when adding a Tag, it just calls some methods in its "VisualizationAdded"-Event.
In my other TagVisualizers before there were no cross-hair but they always had Visualizations added like this in the initialization of the TagVisualizer: tagDef.Source = new Uri("something.xaml", UriKind.Relative);
But how can I ged rid of this cross-hair?
I cannot find anything about it.
By the way, it looks like this: http://img80.imageshack.us/img80/4728/crosshairc.png
http://img80.imageshack.us/img80/4728/crosshairc.png'/>
I've just run into the same problem because I didn't want a TagVisualization to display when I put a tag down (I wanted some items to be displayed in an already displayed librarystack). I solved it by setting the source of the ByteTagDefinition to null
ByteTagVisualizationDefinition tvBlue = new ByteTagVisualizationDefinition();
tvBlue.Value = 02;
tvBlue.Source = null;
MainTagVisualizer.Definitions.Add(tvBlue);
This gets rid of the crosshair - and I assume will work for IdentityTags, although I have not tried.
the crosshairs are used as the default visualization if you dont specify a custom source. we did this in order to let developers get the layout & configuration working without having to first define the visualization. a crosshair was selected as a default visual because it can be helpful in validating your physical offset properties
-robert (former PM for the Surface controls)