I'm developing a Codename One app for iOS.
I defined a button as follows:
Button signUpButton = new Button();
signUpButton.getAllStyles().setBorder(Border.createEmpty());
signUpButton.getAllStyles().setBgTransparency(255);
signUpButton.getAllStyles().setBgColor(0x9d1710);
signUpButton.getAllStyles().setFgColor(0x848484);
signUpButton.getAllStyles().setMargin(Component.LEFT, 4);
signUpButton.getAllStyles().setMargin(Component.RIGHT, 4);
signUpButton.setCapsText(true);
signUpButton.setText("Conferma");
After that, I created a Validator, I added some constraits to other text fields and then I added the button to the validator:
validator.addSubmitButtons(signUpButton);
The addSubmitButtons method changes the style I set for the button (in particular, the margins and size changed).
I also tried to set the style I want to the button after the addSubmitButtons method, but it seems it doesn't consider it. It happens on simulator and on device too.
This is what happens without calling the addSubmitButtons method:
This is what happens calling the addSubmitButtons method:
How can I solve that problem?
When the validation doesn't pass the button is set to disabled so the the disabled style is picked of the 4 styles.
I'm guessing here but I'm assuming that the margin/padding of the disabled style is still set in pixels instead of millimeters for the native theme. If you explicitly set all styles to use millimeters it should work.
Related
First, I added a button and set it's size to be 40
Then, in ViewController, I will change its text when user tap the button
startStopBtn.setTitle("START", for: .normal)
But not only the title change, the size also changed to 17.
Why is that? I want to keep the size unchanged.
Im using swift 5
iOS 15 introduced Configuration settings for many controls -- including UIButton.
When you create a button using Storyboard / Interface Builder in Xcode 13, the default configuration is Plain. Without changing that, you need to use the options via UIButton.Configuration to change much (most) of the button's appearance.
Selecting Default from the Button Style drop-down gives you a "pre-iOS 15" type of button.
I'm facing a very weird (& blocking) issue using diagrams.net webapp.
I'm trying to add some nodes in the Format Panel. I created a new tab in this panel & added in it some new inputs.
There are text inputs, checkbox inputs & textarea.
But the behavior is absolutely not the expected one.
For text & cb inputs, everything works fine, but textareas behavior is... at least very weird:
The field can't get focus by mouse clicking (remember that click works on other inputs). The only way to set the focus on it is by using JS focus() method.
Text inside the tag can't be selected by mouse. If element has the focus, text can be updated. Moreover, even if text can be changed, text cursor cannot move from the end of the text.
Textarea box is not resizable. There is the bottom-right arrow to resize it & I added the "resize" value to be sure but the feature doesn't disable but I juste can't. BUT ! If I set the attribute "disabled" then I can resize the box. Unfortunately, I can't disable the textarea since I want to put it because I need to write in it.
I can't show you code for now (it's just a new node creation using document.createElement) but you can easily test this: go to drawio webapp & when the webapp is loaded, use the Inspector in the developer tools to add a new textarea node in the format panel (div with ".geFormatContainer" class) : element is not focusable with the mouse, text inside it is unselectable & box is not resizable as long as "disabled" attribute is not set.
I added a click listener in the component to check if click did something & it does, but it doesn't give the focus to the element (document.activeElement says that body is focused -_-) so I think there is something in mxgraph which avoids the element's classic behavior. But what ?
I am learning Delphi and building a simple NotePad. However, as soon as I add an Action to some ToolButtons (note the align left, center, and right buttons and Bold), they are disabled in the running app, although the Enabled property is set to true in the Object Inspector. They become enabled in the running app if I remove the Action from them in the Object Inspector, but then they are just useless clickable buttons. I have added some pictures below.
I have Googled and tried myself almost to insanity and I really can't figure it out myself.
A normal TAction needs an OnExecute event to become enabled. You can control this with the property DisableIfNoHandler, which defaults to True.
I have a need where I need to dynamically keep changing the underline status of a particular Text in Xamarin Forms label.
After referring multiple posts on how to underline a label, I tried both the options, creating a custom renderer as well as using Effects. The text underlines fine. However the problem is that the underline status of the Label doesn't update. This problem however is only in iOS, Android works fine.
I created a bindable property HasUnderline in my Custom Label class in Xamarin Forms. The OnElementPropertyChange method in iOS is fired within the CustomRenderer. I then also change the underline property of the control using
text.AddAttribute(UIStringAttributeKey.UnderlineStyle, NSNumber.FromInt32((int)NSUnderlineStyle.Single), range);
However, the same is not reflected in the UI.
After so many hours of my head banging, I finally, however, did notice that if I change the value of the Text, the underline immediately reflects. So it appears the changing the underline property doesn't reflect until something in the content of the text is changed. But I don't want to change the text while adding/removing the underline.
How can I solve this issue?
I have some TSpeedButtons on a form that has multiple uses. In one mode I don't want one button to be clicked so I just set "Enabled:=False;"
But, if it was Down and I force it to Enabled:=False it goes to the Up-State. How can I prevent "Enabled" affecting the current Up/Down State as I still need it to visually show the current State.
In short, you cannot do what you are asking for with a standard TSpeedButton. This is just the way it is coded to work.
When you set Enabled to false on a TSpeedButton, the button gets drawn in a disabled state regardless of its Down property. The TSpeedButton.Paint() method forces the State property to bsDisabled, wiping out any current Up/Down state. In Delphi 5, this causes the button to be drawn with an Up appearance. In more modern versions of Delphi, if visual styles are enabled, the button gets drawn with a flat appearance that is neither Up nor Down.
The only way to change this behavior is to either:
derive a new class from TSpeedButton and override the virtual Paint() method so you can custom-draw the button yourself however you want. You will have to draw the entire button, though.
make a copy of the VCL's Buttons.pas source file (Vcl.Buttons.pas in XE2 and later), add the copied file to your project (make sure Runtime Packages are disabled), and then you can modify the implementation of TSpeedButton.Paint() itself however you want. Just know that this will affect every TSpeedButton in your project.