DialogFragment Position Listener - dialogfragment

Is there any way to determine when the x position of a dialog fragment changes?
I have an animation on my dialog fragment. The animation increases the height of a textview when the edittext (that's within the textview) gets focus and decreases the height when the edittext loses focus. When I press back I want the edit text to lose focus, but it still has it. So now I am trying to figure out how to determine when the x position of the dialog fragment changes when the keyboard disappears, so that I can clear the focus when I press back.

Related

How do I overcome Godot changing the button font to the default color?

I am using Godot 4. I have a lot of buttons created manually in a container. I have a color variable (tempcol) set in the main scene. When I click a button with the tempcol set say Color.Red- the button's font color changes to white (seems to the default font color) but when I click another button the original button changes to red( the correct button's text is set to the correct color but first set to the wrong color). No button prefab settings seem to make a difference. The Normal Style is set to StyleBoxFlat (which a white background). Is there anything I can do make the font's color immediately appear as the right color?
pressed.connect(c);
func c():
if (get_parent().tempcol!=Color.BLACK):
set("custom_colors/font_color", get_parent().tempcol);
get_parent().check(num,squx,squy,bsqu);
else:
var B1=B.instantiate();
B1._set_position(Vector2(centrex,centrey));
B1.num=num;
get_parent().call_deferred("add_child", B1);
Button States
I'm beginning this answer with a description of the states when using the mouse, as it is the more complex way to interact with the Button.
When you have the Buttons in the scene, unless you have them Disabled, they will be in their Normal state.
When you move the pointer over the Button, it goes from Normal to Hover. And if you move the pointer out, it should return from Hover to Normal.
If you click the Button it goes from Hover to Pressed. And now the button has focus.
When you release the click on top of the Button, it goes from Pressed to Hover (this can happen to fast to see the Pressed state). Then when you move the pointer out of the Button, it goes from Hover to Focus (not to Normal).
Alternatively, you can move the pointer out of the Button instead releasing the click, which also results in the Focus state.
And when you interact with another Control, it goes from Focus back to Normal.
State Graph using mouse
This is the graph of the states of the Button when you are using a mouse:
So we see the Button can take two 5paths from Normal to Normal:
Normal -> Hover -> Normal
Here you moved the mouse pointer over the button, and moved it out.
Normal -> Hover -> Pressed (hover + focus) -> Hover (focus) -> Focus -> Normal
Here you moved the mouse pointer over the Button, pressed and released click, then moved the mouse pointer out and clicked some other Control.
State Graph using touch
When you are using touch input, there is no Hover state, so the graph reduces to this:
And here we have one single path from Normal to Normal: Normal -> Pressed + Focus -> Focus -> Normal. Here you tap the Button, and then tap on some other Control.
Graph State when using keyboard input
When using keyboard it is similar to using touch in that there is no Hover. However, we control Focus independently from Pressed, which results in this:
And here we have three paths from Normal to Normal:
Normal -> Focus -> Normal.
Here you tab into the Button, and tab out of it.
Normal -> Focus -> Pressed + Focus -> Focus -> Normal.
Here you tab into the Button, press and release it, then tab out of it.
Note: You could try to tab out without releasing the Button, which results in the Button going directly from Pressed (Focus) to Normal (It is similar to moving the mouse out from the Button while holding the click). However, I have decided to not count it as separate transition nor path.
Button Color
Alright, now we know the states, what color do we see in each state?
Godot 3:
Normal: custom_colors/font_color.
Hover: custom_colors/font_color_hover.
Pressed: custom_colors/font_color_pressed.
Focus: custom_colors/font_color_focus.
Disabled: custom_colors/font_color_disabled.
Note: When you have Hover combined with Focus, you still get custom_colors/font_color_hover. And when you have Pressed combined with Hover or Focus, you still get custom_colors/font_color_pressed.
Godot 4:
Normal: theme_override_colors/font_color.
Hover: theme_override_colors/font_hover_color.
Pressed: theme_override_colors/font_pressed_color.
Focus: theme_override_colors/font_focus_color.
Disabled: theme_override_colors/font_disabled_color.
Note: Similar to what happens in Godot 3, when you have Hover combined with Focus, you still get theme_override_colors/font_hover_color. And when you have Pressed combined with Hover or Focus you still get theme_override_colors/font_pressed_color. In fact, I could not manage to get theme_override_colors/font_hover_pressed_color.
Your Questions
When I click a button (…) the button's font color changes to white
That is not the Normal color. While you have the Button pressed, you are looking at the Pressed color. Once released, if the mouse pointer is over the Button you are looking at the Hover color. Otherwise, this is the Focus color.
when I click another button the original button changes to red
That is the Normal color.
No button prefab settings seem to make a difference.
Prefab is not a thing. This is Godot.
Is there anything I can do make the font's color immediately appear as the right color?
It is not a matter of "immediately", but what state do you want to change the color for. I suspect you want to set colors for Focus, Hover and Pressed to the same as the color for Normal. And be aware that knowing the state is important for user experience. Which Control has focus is in particular important for keyboard only input.
I set every single theme_override font color.
set("theme_override_colors/font_pressed_color", get_parent().tempcol);
set("theme_override_colors/font_hover_color",get_parent().tempcol);
set("theme_override_colors/font_color", get_parent().tempcol);
set("theme_override_colors/font_focus_color",get_parent().tempcol);
and it was only when I set the font_focus_color did it set change to the correct color immediately.

How to select two buttons in a screen at the same time in UWP

I used button PointerFocus event to set the button border. Need to set border on two buttons in the same screen. Is There a way to set the border of one button without remove the border from a previously selected button in UWP.
The act of getting focus is unique. In other words, when a control gets focus, the previous control loses focus.
If you need the button to remain selected, you may not need Button, but ToggleButton.
ToggleButton has two states (selected/unselected), while retaining the appearance of Button. You can have multiple ToggleButtons selected at the same time.
Here is the document about the ToggleButton.
Best regards.

TableView Scrolling on Button Click Qml

Is there any property by which i can scroll up and down on button clicked in tableview. I don't want vertical scroll bar visible but i want to make it scroll on button clicks ?
I don't want to increment currentrow value, i want to make currentrow value fix,
I just want to scroll tableview list on button click.
You can use flick method to scroll TableView. For scrolling down:
myTableView.flick(0, -1000)
and for scrolling up:
myTableView.flick(0, 1000)
Here 1000 is the velocity in y direction. You can change it to your desired value.

How to increase the clickable area of a QPushButton in Qt?

The Back button in the top left corner of my touch user interface is a little hard to press on a resistive touchscreen, because the touch events are not so precise at the borders of the screen.
The visual size of the button can't really be increased because the screen space is needed for other things. Thus I would like to increase only the clickable area of the button. So when the user touches somewhere in the top left corner of the screen (as marked in red), the back button should be pressed. Note that the red area also overlaps another button. Ideally, the visual button state would also change to the "pressed" state.
Can anyone give me some pointers in the right direction? I have considered the following things, but I'm unsure which would work.
Overlaying the actual button with a larger, invisible button, painted with a transparent brush. But I have no idea how I could paint the smaller button as "pressed" when the user is pressing the invisible button.
Creating a new class based on QWidget, which has the size of the red area (with invisible background) and contains the actual button. Then relay touch events to the button so that it is pressed when the user touches the empty area.
Subclassing QPushButton and reimplementing QAbstractButton::hitButton to accept points outside of the button's area. But I guess that function would probably isn't even called when I touch outside the widget area.
To occupy more vertical space inside a layout, set buttons vertical policy to expanding.
To increase the clickable area without increasing the visual size, increase the margin.
To have the back button overlapping other buttons, don't put it to a layout. Instead set its parent directly and move it to the corner.
backButton = new QPushButton("< Back", mainWindow);
backButton->setStyleSheet("margin: 30;");
backButton->show();
backButton->resize(150, 90);
backButton->move(-30, -30);

Flash CS6 - Button Up/Over States

I have a button in the "up" state and when the mouse is over the button, it is supposed to get much bigger in the "over" state. So, the button in the "over" state is 3 times bigger than the button in the "up" state.
However, the problem is the over state button triggers before my mouse touches the up state button. I only want the button to get bigger AFTER the mouse is on the up state button.
I figured out that the over state button is triggering early because my mouse touches the area where it should be even though it's not visible.
Thus, if I move my mouse around the button in up state without touching it, it still gets bigger because my mouse touches the area of the over state button.
How would I fix this so the over state button doesn't trigger until my mouse is actually on the up state button?
If you made a button symbol:
If you edit your button symbol, you will see four named frames in your timeline:
Up
The state your button is in when no mouse actions occur.
(Your "small" button state.)
Over
The state your button is in on mouse over.
(Your "big" button state.)
Down
The state your button is in on mouse click.
Hit
The area that will accept those mouse events (click, hover).
This area represents the place a person can move their mouse to activate your button. You can make it any shape (or combination of shapes), but it is generally the same as the visible "up" state of your button.
If you copy the keyframe in your "up" state to the frame that is labeled "hit", your button will only react when you hover over that area.
If you made a button using AS3:
Your hitTestState needs to be the same size as your upState.
One easy way to do that is:
buttonName.hitTestState = buttonName.upState;
You need to adjust the hit area

Resources