Changing colours for button which have got a focus - dotnetbar

I use DotNetBar controls. I can change colours for buttons with:
Office2007ColorTable table = ((Office2007Renderer)GlobalManager.Renderer).ColorTable;
Office2007ButtonItemColorTable bt = table.ButtonItemColors[6];
bt.Default.Background = new LinearGradientColorTable(Color.White);
bt.MouseOver.Background = new LinearGradientColorTable(Color.Green);
Unfortunate I cannot find how I can change colour for a focused button.
Is it possible?

Related

How to change disabled color in MRTK Interactable buttons correctly?

I am working to an application with unity3D and MRTK package for hololens2 and I am trying to change the color of a toggle when it is disabled.
The toggle has an Interactable script on it with many profiles, one of them has two themes for the selected state that are "InteractableActivateTheme" and "Interactable color children theme".
I used successfully the latter to change color of the toggle when selected using the theme field "Pressed" and "Default", but I am not able to use the "Disabled" field in any case.
Screenshot of the profile I am talking about
I disable the toggle by code setting the state to disabled in this way:
PlaceToggle.SetState(InteractableStates.InteractableStateEnum.Disabled, true);
PlaceToggle.enabled = true;
The toggle disables itself but the color remains red has set in the "Default" State Properties of the "InteractableColorChildrenTheme".
I also tried to change the color by code like this, but I had no result:
var activeThemes = PlaceToggle.ActiveThemes;
foreach (InteractableThemeBase itb in activeThemes)
{
if (itb is InteractableColorChildrenTheme)
{
Debug.Log(" changing state property");
var property = itb.StateProperties;
oldColor = itb.StateProperties[0].Values[0].Color;
itb.StateProperties[0].Values[0].Color = Color.gray;
}
}
Any idea on how could I understand what it is happening and why it is not working??
Thanks you all
Please try the following code to disable your button:
buttonInteractable = this.GetComponent<Interactable>();
buttonInteractable.IsEnabled = false;
Verified in MRTK2.7 & Unity 2019.4.22.

Localize button Swift

For example I've got an app which has a textLabel and a button which are firstly set as:
mainLabel.attributedText = "labelNewText".uppercased()
mainButton.titleLabel?.attributedText = "buttonNewText".uppercased()
Then I've created a Localization file, where I set a some values for a German language:
"labelNewText" = "Etikette";
"buttonNewText" = "Taste";
And rewrote set ups for label and button like:
mainLabel.attributedText = "\(NSLocalizedString("labelNewText", comment: ""))".uppercased()
mainButton.titleLabel?.attributedText = "\(NSLocalizedString("buttonNewText", comment: ""))".uppercased()
Though, right after after I change my phone language setting to German, the translation only works for a Label but is not working for button. What am I doing wrong and how to localise button titleLabel?
You have to use UIButton's setAttributedTitle:forState: instead of trying to manipulate the text label itself. So for example:
mainButton.setAttributedTitle(myAttributeString, forState: .normal)

How to place widgets like labels & buttons with `.pack()`?

Hello i am asking for help on a PyDev Eclipse problem i cold not find a solution on at this forum. My example below show that i have a window with a couple of labels and buttons etc. But the ting is that when i searched earlier i found posts on how to place widgets using .grid() and .place() but not any for .pack() which i am using. Therefor i want to know what would be the best way for me to place these widgets for example in the center of the parent window.
Thanks in advance. :D
window.title("PTF Pydev Eclipse")
window.geometry("500x500")
window.config(bg="blue")
frame = tk.Frame(window, bg="blue")
lbl = tk.Label(frame, text= "secret")
lbl.config(background="blue", width="500")
ent = tk.Entry(frame)
lbl1 = tk.Label(frame, text= "secret", bg="blue")
ent1 = tk.Entry(frame)
lbl2 = tk.Label(frame, text= "secret", bg="blue")
btn = tk.Button(frame, text="secret", command= lambda: validation())
btn2 = tk.Button(frame, text="secret", command=lambda: page1())
lbl3 = tk.Label(frame, bg="blue", text="secret")
ent2 = tk.Entry(frame) #these 3 are packed in a function (not included).
lbl.pack()
ent.pack()
lbl1.pack()
ent1.pack()
lbl2.pack()
btn.pack()
frame.pack()
window.mainloop()
Do not use pack if you want to control the exact position of each widget.
Your window is 500x500, right ?
So for example if you want to place a widget at the top left of your window, you could to
Yourwidget.place(x=10, y=10)
Hope It helps, good luck.

GtkToolbar: How to add Toolitem to toolbar using PyGObject

How can I add icons to a GtkToolbar using PyGObject?
I can create the toolbar and an icon without any problems:
self.toolbar = Gtk.Toolbar()
self.item = Gtk.ToolItem()
But adding the item to the toolbar doesn't seem to work like this (Found this in the PyGTK documentation):
self.toolbar.Container.add(self.item)
The solution is actually pretty simple:
self.button = Gtk.ToolButton(Gtk.STOCK_ABOUT)
self.toolbar.insert(self.button, 0)
User button instead of item and then choose an icon from this list: http://python-gtk-3-tutorial.readthedocs.org/en/latest/stock.html
Then use .inset with the object and the position (in this case 0, meaning the first item in the toolbar).

Hiding cursor in Text component in Eclipse RCP application

In my eclipse RCP application there are a few buttons & few input boxes & this below Text component. My problem is as soon as I press one of the buttons a cursor starts blinking in the below test component. Can you please let me know how to solve this.
I tried:
setting focus to false for Text.
SWT.READ_ONLY for Text .
Code:
Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_NO);
protocolFilterDescription.setCursor(cursor);
Nothing seems to get rid of this unnecessary cursor.
protocolFilterDescription = new Text(parent, SWT.NONE | SWT.READ_ONLY );
FormData protocolFilterDescriptionLData = new FormData();
protocolFilterDescriptionLData.left = new FormAttachment(0, 1000, 650);
protocolFilterDescriptionLData.top = new FormAttachment(0, 1000, 290);
protocolFilterDescriptionLData.width = 450;
protocolFilterDescriptionLData.height = 12;
protocolFilterDescription.setLayoutData(protocolFilterDescriptionLData);
protocolFilterDescription.setForeground(new Color(parent.getDisplay(),
204, 153, 0));
protocolFilterDescription.setBackground(Display.getCurrent()
.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
protocolFilterDescription.setFont(new Font(parent.getDisplay(),"Verdana",
6, 1));
protocolFilterDescription
.setText("captured");
You have to set the focus of some other SWT component to true to remove the focus from the Text component.
You'll probably have to do this in an ActionListener.
If you want to completely remove the cursor from the Text control (which implies inability to perform a selection there, etc), try calling setEnabled(false) on it.
Also, such requirement suggests that you maybe don't need Text component at all, and could use Label instead.