GAMEMAKER 2.o Increasing timer after press a button - game-maker

How do i make a decreasing timer after pressing some button? Actually trying to maker in step event but the timer only decreases 1 per times which the button was pressed.

Just judging the functionality from the given information: you've set the timer in an event that you can only reach when a button is pressed.
If it only happens when you press the button, then that means the timer will only decrease if you either hold the button or click the button repeately.
A possible solution is to make a new boolean, and set that boolean to 'true' when the button is pressed. Then you make a new statement that checks if the boolean is true, and put the timer inside that statement.
Hopefully this helps.

Related

How to catch a Qt hold event

How can I catch a mouse hold event in either Qt or Qt Modeling Language? I don't mean hold as in press the button and wait a certain delay before emitting a signal. I mean a user clicks a button and while its not released I want it to emit signals so that I can, for example make an object follow the mouse position while its being held down.
The way i solved it was using a Timer event. Each time the Timer was triggered, id check if the mouse was pressed.

Can a QML DelayButton's flashing be programmatically turned off?

I have a DelayButton that I would like to stop flashing (after it's been pressed) when the operation triggered by the button is completed.
However, it appears that none of the properties DelayButton are writeable. Is there a way to stop the flashing, or must it always flash until the user presses the button again?
DelayButton is a subclass of the Button. The flashing state is actually linked to the checked property of the Button, so the button.checked = false will help.
You can always look into the source code: http://code.qt.io/cgit/qt/qtquickcontrols.git/tree/src/extras/DelayButton.qml

How to Kill focus of an MFC button control

I have an MFC button control and I am trying to handle the "OnPressed" event of it by starting a timer on click and making it go through my event in the OnTimer function. This all works fine but the focus remains on the button and if I click outside of the button area, the app carries out the OnPressed event. Any suggestions on how to kill the focus on the button when the mouse is pressed outside of the button area? My code for getting the focus and button ID.
void Dlg::OnTimer(...)
{
CWnd * pFocus = GetFocus();
int btnID = 0;
if (pFocus != NULL && pDialog->IsChild(pFocus))
btnID = pFocus->GetDlgCtrlID();
// Carry on my button pressed activity
Buttonpressed();
}
So basically I am getting the proper button press and I can carry out the desired action using the Buttonpressed() function given above. Now my problem is, once that button is pressed, it gets focus and the focus remains even after I leave the mouse and move out of the area of the button. Because of this behaviour, if I click outside of the button area, the application still thinks that I am in the mouse area and pressing the button. Is there a way I could remove focus after the mouse is moved out of the button area and then bring focus back in again when it is in the button area?
Looking forward to your suggestions.

QTableView: Best way to change activation-trigger to double-click

In my application, I have one tableview of items, and a side-panel "preview":ing the latest selected item.
I want clicking on an item to change the selection, and double-clicking to cause a "run"-action to be performed. More specifically, I want the "run"-action (including key-navigation and pressing enter) to be bound to the "activation" of the item in the table-row.
My problem is; single-clicks does not only change the selection, but fires the "activated" signal on the item. I would like to tweak it such that:
Navigation Keys, Single Mouse Click: Selection-change, update preview-panel
Enter Key, Double Mouse Click: Activate/run/open action triggered.
Is there a nice clean way to do it, or are overriding the onclick/doubleclick events my best option? Or is there some other tabular list-widget better suiting my needs?
I would connect the slot for the preview action to the currentChanged() signal of the table view's selectionModel(). This covers single clicks and key navigation.
Then there's two options for the double clicks and Enter key presses:
Subclass your tableview, override doubleClickEvent() and keyPressEvent() and fire your custom signal in there, with maybe the model index or something else as an argument. Then just connect your run method to your own signal as you have full control over when it is fired.
If you don't want to subclass, you can use the installEventFilter() mechanism.
Either I'm getting your approach wrong or I'm too tired, but if you want to trigger a run event you should avoid the activated signal completely. Set the signal slot mechanism so that your double click and Enter key press event trigger your run() function, and then the single click/nav buttons should trigger the 'activated' slot which will return your index in the tableview.
I'm pretty certain Qt wants you to be explicit about which signal points to which slot or it'll ignore it or point to a default.

SliderEvent.clickTarget does not change

In my web based flex app I have a HSlider to which 'change' event listener is binded. Inside the event listener function I have the following.
trace('slider click target: '+e.clickTarget);
I am changing the slider value from a timer (say every second). At this time, in the console I see that traget is being printed as null every second.
Now, if I change the value by dragging the thumb, it prints target as thumb. And then onwards it keeps printing the target as thumb every second instead of printing null. The same thing happens if change the slider value by clicking track (it keeps printing track).
Basically, I have the event listener to find out if the value of the slider is changing due to the timer, click on thumb or click on track. Kindly let me know if this issue can be fixed or is there any other approach I can follow. Thanks!!
This is strange, because the documentation says that the change event is dispatched when the slider changes value due to mouse or keyboard interaction - the event is not triggered when you change it programmatically, and the listener shouldn't even be called.
Are you calling the event listener manually? Post some more code - where you update the slider value and the full event listener.

Resources