I am using fontImages in codename one to the Toolbar. So our requirement is to set name below to that Font Images.
Something like this:
Command cmd = toolbar.addMaterialCommandToRightSide("Name", FontImage.MATERIAL_INFO, e -> {});
Button b = toolbar.findCommandComponent(cmd);
b.setTextPosition(Component.BOTTOM);
Related
I'm developing an app, i chose the flat orange theme but the tittlecommand isn't visible, just appears if I slide to the right and it appears
I checked the theme.res in the titlecommand unselected item but it seems ok
if I click on it nothing happens, only when I slide it to the right
How could I make the tittle command appears when it is unselected?
--------------------------------------------------------------------
UPDATE 01/15/2020
The container appears with width=0 and height=0.
But how could I change it.
The code of the slide menu is
Style s = UIManager.getInstance().getComponentStyle("TitleCommand");
FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_TITLE, s);
Image logo = res.getImage("index.jpg");
Container topBar = BorderLayout.west(new Label(logo));
topBar.add(BorderLayout.SOUTH,new Label("Los del Camino","SidemenuTagline"));
getToolbar().addCommandToLeftBar("",icon,null);
getToolbar().addComponentToSideMenu(topBar);
getToolbar().addMaterialCommandToSideMenu("Inicio",FontImage.MATERIAL_HOME, e -> new Hola().show());
getToolbar().addMaterialCommandToSideMenu("Estudios",FontImage.MATERIAL_BOOK, e -> {} );
getToolbar().addMaterialCommandToSideMenu("Calendario", FontImage.MATERIAL_CALENDAR_TODAY, e -> new Calendario(res).show());
getToolbar().addMaterialCommandToSideMenu("Documentos", FontImage.MATERIAL_FILE_PRESENT, e -> {});
getToolbar().addComponentToSideMenu(new Label(" ", "SideCommand"));
getToolbar().addMaterialCommandToSideMenu("ACERCA DE", FontImage.MATERIAL_LIVE_HELP , e -> {});
we want dialog message in this format and look and fill
Can you please let me know how to resolve it. My application needs to be supported on all platforms (Android, iOS, Windows) and I don't want to write native code for all platforms separately.
Actually customizing the look is easier in Codename One as everything is written in Java you can customize literally everything about the look of anything.
For simplicity sake I used code rather than styles which would be better, you can customize the Dialog UIID and other UIID's in the theme designer to get more flexibility and have this easier. However, this would require many screenshots and explanations so I did the customization in code:
Form f = new Form("Test");
Button b = new Button("Show Dialog");
f.add(b);
b.addActionListener(e -> {
Dialog dlg = new Dialog("Authentication");
Style dlgStyle = dlg.getDialogStyle();
dlgStyle.setBorder(Border.createEmpty());
dlgStyle.setBgTransparency(255);
dlgStyle.setBgColor(0xffffff);
Label title = dlg.getTitleComponent();
title.setIcon(finalDuke.scaledHeight(title.getPreferredH()));
title.getUnselectedStyle().setFgColor(0xff);
title.getUnselectedStyle().setAlignment(Component.LEFT);
dlg.setLayout(BoxLayout.y());
Label blueLabel = new Label();
blueLabel.setShowEvenIfBlank(true);
blueLabel.getUnselectedStyle().setBgColor(0xff);
blueLabel.getUnselectedStyle().setPadding(1, 1, 1, 1);
blueLabel.getUnselectedStyle().setPaddingUnit(Style.UNIT_TYPE_PIXELS);
dlg.add(blueLabel);
TextArea ta = new TextArea("This is the text you want to appear in the dialog, this might line break if the text is too long...");
ta.setEditable(false);
ta.setUIID("DialogBody");
ta.getAllStyles().setFgColor(0);
dlg.add(ta);
Label grayLabel = new Label();
grayLabel.setShowEvenIfBlank(true);
grayLabel.getUnselectedStyle().setBgColor(0xcccccc);
grayLabel.getUnselectedStyle().setPadding(1, 1, 1, 1);
grayLabel.getUnselectedStyle().setPaddingUnit(Style.UNIT_TYPE_PIXELS);
dlg.add(grayLabel);
Button ok = new Button(new Command("OK"));
ok.getAllStyles().setBorder(Border.createEmpty());
ok.getAllStyles().setFgColor(0);
dlg.add(ok);
dlg.showDialog();
});
f.show();
I would recommend doing the dialog customization in the theme designer and using a 9-piece image border which is better looking.
I'm trying to use the material icon font in my title commands without transforming them in a FontImage but I can only obtain very little chars.
Style s = UIManager.getInstance().getComponentStyle("TitleCommand");
s.setFont(FontImage.getMaterialDesignFont().derive(s.getFont().getHeight(),
Font.STYLE_PLAIN));
UIManager.getInstance().setComponentStyle("TitleCommand", s);
this should give me the possibility to have multiple icons in a single command but the chars/glyphs I get are very small (on iphone3 simulator they are scaled to a single pixel!).
What is wrong?
This code worked for me:
Toolbar.setGlobalToolbar(true);
Style s = UIManager.getInstance().getComponentStyle("TitleCommand");
s.setFont(FontImage.getMaterialDesignFont().derive(s.getFont().getHeight(), Font.STYLE_PLAIN));
UIManager.getInstance().setComponentStyle("TitleCommand", s);
Form hi = new Form("Test");
hi.getToolbar().addCommandToRightBar("" + FontImage.MATERIAL_3D_ROTATION, null, e -> Log.p("Invoked"));
hi.show();
To produce this:
I usually use a more conventional way of creating an icon with a millimeter size but this should work.
I'm trying to add a row on a qx.ui.mobile.page.NavigationPage consisting of a label, a text field, and a button. I want the text field to take up any extra horizontal space (the row should span the screen horizontally). I thought this would work:
var comp = new qx.ui.mobile.container.Composite();
comp.setLayout(new qx.ui.mobile.layout.HBox(null, 'middle'));
comp.add(new qx.ui.mobile.basic.Label("Filtering:"));
var f = new qx.ui.mobile.form.TextField();
comp.add(f, {flex:1});
var b = new qx.ui.mobile.form.Button("Update");
comp.add(b);
this.getContent().add(comp);
but it doesn't (see http://tinyurl.com/nwlhtwq for a playground example).
What am doing wrong? Thanks!
Have a look at this example:
http://tinyurl.com/nmw6lgs
It is because the textfield has a "display:inline-block" by default, and width of 100%.
Please set these properties:
qx.bom.element.Style.set(textField.getContentElement(),"display","block");
qx.bom.element.Style.set(textField.getContentElement(),"width","auto");
We will fix that in framework, too.
I want to show the color and font dialog box in WPF .net 4.5, how to can I do?
Please help me anybody.
Thnx in Advanced!
The best out of the box solution is using FontDialog form System.Windows.Forms assembly, but you will have to convert it's output to apply it to WPF elements.
FontDialog fd = new FontDialog();
var result = fd.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
{
Debug.WriteLine(fd.Font);
tbFonttest.FontFamily = new FontFamily(fd.Font.Name);
tbFonttest.FontSize = fd.Font.Size * 96.0 / 72.0;
tbFonttest.FontWeight = fd.Font.Bold ? FontWeights.Bold : FontWeights.Regular;
tbFonttest.FontStyle = fd.Font.Italic ? FontStyles.Italic : FontStyles.Normal;
TextDecorationCollection tdc = new TextDecorationCollection();
if (fd.Font.Underline) tdc.Add(TextDecorations.Underline);
if (fd.Font.Strikeout) tdc.Add(TextDecorations.Strikethrough);
tbFonttest.TextDecorations = tdc;
}
Notice that winforms dialog does not support many of WPF font properties like extra bold fonts.
Color dialog is much easier:
ColorDialog cd = new ColorDialog();
var result = cd.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
{
tbFonttest.Foreground = new SolidColorBrush(Color.FromArgb(cd.Color.A, cd.Color.R, cd.Color.G, cd.Color.B));
}
It does not support alpha though.
You can use classes from System.Windows.Forms, there is nothing wrong with using them. You'll probably need to convert values to WPF-specific though.
Alternatively, you can implement your own dialogs or use third-party controls, see Free font and color chooser for WPF?.