I have a Bot developed in SDK 4. I am using PromptOptions in Dialog as below :
var options = new PromptOptions()
{
Prompt = MessageFactory.Text("Please select the services "),
RetryPrompt = null,
Style = ListStyle.HeroCard,
Choices = GetMainMenuChoices(),
};
I need to style the Hero card which as of now is in rectangle shape. Can I make it look like rounded corner with some color & do some customize style? Thanks.
Related
I am trying to add an icon to the title/ title bar.
Changing the title itself with code works fine :
setTitle("Testing");
Yet I can't figure out a way to add an icon to it. Here is what I have tried, with no avail:
Image img = Image.createImage("/kalender.png");
getTitleComponent().setIcon(img);
FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_SEARCH, "TitleCommand", 3);
getTitleComponent().setIcon(icon);
Any help would be appreciated.
setTitleComponent will solve it as soon in below
FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_SEARCH, "TitleCommand", 3);
Label title = new Label(icon);
**setTitleComponent(title);**
[EDIT]
**getToolbar().setTitleComponent(titles);**
This works for me:
Form form = new Form(BoxLayout.y());
Image icon = FontImage.createMaterial(FontImage.MATERIAL_CAKE, "TitleCommand", 5).toImage();
Label tittleButton = new Label("Tittle", icon, "Label");
form.getToolbar().setTitleComponent(tittleButton);
form.getToolbar().setTitleCentered(true);
form.show();
From the shiny dashboard github, I've gathered that it's possible to create drop down menus at the top right of the header, but there are only 3 "types" (messages, notifications, and tasks).
https://rstudio.github.io/shinydashboard/structure.html#structure-overview
Is there a method for creating a custom dropdown? I'd like to make a settings dropdown, where I give the user some checkboxes that they can use to adjust the dashboard in ways (displaying/hiding things, filtering data, etc.)
I customized one of the three types of menu to allow this. You could then add actionItem(s) for items. tabSelect property when true simulate the selection of a sidebarMenuItem.
dropdownActionMenu <- function (..., title=NULL, icon = NULL, .list = NULL, header=NULL) {
items <- c(list(...), .list)
lapply(items, shinydashboard:::tagAssert, type = "li")
type <- "notifications" # TODO créer action + CSS
dropdownClass <- paste0("dropdown ", type, "-menu")
tags$li(class = dropdownClass, a(href = "#", class = "dropdown-toggle",
`data-toggle` = "dropdown", icon, title), tags$ul(class = "dropdown-menu",
if(!is.null(header)) tags$li(class="header",header),
tags$li(tags$ul(class = "menu", items))))
}
actionItem = function (inputId, text, icon = NULL, tabSelect=FALSE) {
if(!is.null(icon)) {
shinydashboard:::tagAssert(icon, type = "i")
icon <- tagAppendAttributes(icon, class = paste0("text-", "success"))
}
if(tabSelect) {
tags$li(a(onclick=paste0("shinyjs.tabSelect('",inputId,"')"),icon,text))
} else {
tags$li(actionLink(inputId,text,icon))
}
}
javascript function to select tab (to be inserted after useShinyjs() in body)
extendShinyjs(text="shinyjs.tabSelect=function(tabName){$('a[data-value='+tabName+']').click();}")
Sample code
dashboardHeader(
dropdownActionMenu(title="test",
actionItem("mnuFirst","First"),
actionItem("mnuSecond","Second")
)
)
Shiny Dashboard is based on admin LTE. So the existing type of drop downs are designed for admin LTE use case, which is quite different from many Shiny app usage.
If something is not even available in admin LTE, it's less likely to be supported in Shiny dashboard.
For your specific question, you can put some controls in the side bar. Another possibility is to use the wrench icon in box, which is not implemented in Shiny yet.
I'm using the awesome wm and i want every window to be to the edge of my monitor without any taskbars or title bars.
Is there a way to do this?
I'm on ubuntu 16.04 LTS.
Yes this should be easy. Simply add the line
fullscreen = true,
to your awesome rules.
Your rules would look afterwards something like this:
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
fullscreen = true,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap+awful.placement.no_offscreen
}
},
The taskbar would be still there but it would be hidden behind the fullscreen window.
cheers
I am using Swift 2.3 in Xcode 7.3. I have a UINavigationController with a UITableViewController. I am trying to set the titleView of the navigation item in the navigationBar to create a button centered in the navigation bar.
The indexTextBut is a UIButton hooked up from the story board. I have tried just creating a new button and it made no perceivable difference. The way I am currently doing it the button is there as it has the behavior it should but no image. I have tried just setting the title field as a string and even then I see nothing. I set the right and left barButtonItems using:
navItem.setRightBarButtonItems(barButtonItems, animated: false)
navItemArray.append(navItemCatDet)
self.navigationController?.navigationBar.setItems(navItemArray, animated: false)
Here is my relevant code. My big question is why can't I see the image of the button being set to the titleView. It has preset behavior and when I click where it should be I get that behavior. I've tried adjusting the frame of the UIButton and its UIImageView, and the size of the UIImageView's image but have had no luck. I included the line aobut tinting the background just incase it is related even though I have tried it with and without.
class MyTableViewController: UITableViewController, UITextFieldDelegate {
#IBOutlet weak var indexTextBut: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
var indexNavItemArray = [UINavigationItem]()
var indexNavItem = UINavigationItem()
indexNavItem.titleView = newButton
indexNavItemArray.append(indexNavItem)
self.navigationController?.navigationBar.barTintColor = UIColor(netHex:0xe63246)
self.navigationController?.navigationBar.setItems(indexNavItemArray, animated: false)
swift 3.0
var indexNavItemArray = [UINavigationItem]()
var indexNavItem = UINavigationItem()
indexNavItem.titleView = indexTextBut
indexTextBut.setTitle("button", for: .normal)
indexNavItemArray.append(indexNavItem)
self.navigationController?.navigationBar.barTintColor = UIColor.lightGray
self.navigationController?.navigationBar.setItems(indexNavItemArray, animated: false)
replace your code to above.
I'm designing a UI in Xamarin.Forms to collect feedback from users about our application. There is an Editor control at the bottom of this page. On an iPhone 4S, and in many landscape orientations, the keyboard completely obscures this editor control. On Android, this is not a big deal because the OS automatically scrolls (though the sizing behavior is a little weird.) On iOS, the only things resembling solutions are very wonky.
In native iOS, the solution is simple: wrap your views in a UIScrollView, then when the keyboard appears add that much space to the content size and scroll appropriately. Xamarin doesn't expose anything to control the scroll position in ScrollView, and ContentSize is private, so that's out. A few posts (here and here) seem to indicate ScrollView is at least part of the solution. It does appear Xamarin has some automatic scrolling behavior, but it's... curious.
My layout is fairly simple:
At the top, a fixed navigation bar that I do not want to scroll out of view.
Beneath that, a 180px tall image that represents a screenshot of the application.
Beneath that, a label with information such as the timestamp. (2-3 lines of text).
Beneath that, the editor, filling the remaining available space.
I've included code for a layout I've tried at the bottom of my post. I created a StackLayout that contains the image, the label, and the editor. I put that inside a ScrollView. Then, I create a RelativeLayout and place the navigation bar at the top-left with the ScrollView beneath it.
What I want to happen when the Editor is tapped is for the keyboard to be displayed and, if it obscures the Editor, for the layout to be nudged upwards to make the Editor visible. What happens instead is it seems like Xamarin scrolls the layout upwards by the keyboard height plus some margin that looks suspiciously like the keyboard utility bar height. This shoves the Editor upwards so high it's obscured by the navigation bar.
I've tried a lot of different tweaks and I'm at a loss. I can't control enough of the ScrollView to get the behavior I need. I've seen suggestions that use a BoxView resized when the Editor gains focus, but to make it work really well I'd still have to hook into the iOS notifications to get the appropriate size and have a fairly intimate knowledge of where my Editor's bounds are. It feels wrong.
Does anyone else have a solution to this on Xamarin.Forms? Even if I have to dip into native, I'd like an answer.
(Here's an example layout that demonstrates the problem, there's a little bit of weird structure because I was debugging. The funky colors are also a relic of layout debugging.)
using System;
using Xamarin.Forms;
namespace TestScroll
{
public class MainPage : ContentPage {
public MainPage() {
InitializeComponent();
}
private ScrollView _scroller;
protected void InitializeComponent() {
var mainLayout = new RelativeLayout();
var navbar = new Label() {
BackgroundColor = Color.Blue,
TextColor = Color.White,
Text = "I am the Nav Bar",
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.StartAndExpand
};
var subLayout = new ScrollView() {
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand
};
_scroller = subLayout;
var subStack = new StackLayout();
subStack.Spacing = 0;
subLayout.Content = subStack;
var image = new BoxView() {
Color = Color.Green,
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.Fill,
HeightRequest = 300
};
subStack.Children.Add(image);
var infoLabel = new Label() {
BackgroundColor = Color.Blue,
TextColor = Color.Black,
Text = "Timestamp!\r\nOther stuff!",
VerticalOptions = LayoutOptions.Start
};
subStack.Children.Add(infoLabel);
var editor = new Editor() {
VerticalOptions = LayoutOptions.FillAndExpand
};
subStack.Children.Add(editor);
mainLayout.Children.Add(navbar,
Constraint.Constant(0),
Constraint.Constant(20),
Constraint.RelativeToParent((parent) => parent.Width),
Constraint.Constant(70));
mainLayout.Children.Add(subLayout,
Constraint.Constant(0),
Constraint.RelativeToView(navbar, (parent, view) => navbar.Bounds.Bottom),
Constraint.RelativeToParent((parent) => parent.Width),
Constraint.RelativeToView(navbar, TestConstraint));
Content = mainLayout;
}
private double TestConstraint(RelativeLayout parent, View view) {
double result = parent.Height - view.Bounds.Height;
Console.WriteLine ("Lower stack height : {0}", result);
Console.WriteLine ("Scroll content size: {0}", _scroller.ContentSize);
return result;
}
}
}
One thing I notice is that you are adding a ScrollView (subLayout) to another ScrollView (_scroller).
Also, I ran into this same problem on iOS except all of my controls were within a Grid. Simply putting the Grid into a single ScrollView fixed the problem, without having to change content sizes or anything like that.
This question sat for a long time unanswered, here's what I did. I don't know that it's the 'answer', and I do appreciate hvaughan3's answer that's currently here and I will try it if I ever get the time.
My page behaved like I wanted on Android, so I didn't do anything specific for that.
So I wrote specific code for iOS that used the notifications UIKeyboardWillShow and UIKeyboardWillHide. These notifications provide information about the bounds the keyboard will take up. So when I get a 'show' notification, I manipulate my layout to allow room for an element of that size I place underneath the keyboard. When I get a 'hide' notification, I reset the layout.
It's janky and a little embarrassing, I hope to come back with news I tried another solution like hvaughan3's and it worked.