I have a CDateTimeCtrl object in my application that displays a time in HH:MM:SS and has an up down control using DTS_UPDOWN. But when I highlight one of the fields and press the up button, it decreases and when pushing down, it increases. why would this be?
Related
I have a QProgressBar showing the progress of an ongoing algorithm. It works just fine in a normal utilization.
But I also have a STOP button allowing user to stop the algo, for example at 42%. At this point, I set the value of the QProgressBar at 42.
The problem is, the progress bar has an animation (like a white ray moving from left to right) showing progress.
I would like to keep this animation when the algorithm is still running, but stop it when user press the Stop button.
I could set the value to 0 or max when the button stop is pressed, but we still want to keep the value when user pressed stop (42% in my example).
It is similar to this question which was not really answered : disable progress bar animation in Qt
I am new to cocos2d-x and I am developing a game in x-code using cocos2d-x2.0.4. In my game I created a button using CCcontrolbutton. Now I want to drag my button to one place to another. I tried with all the CCControlEvents but it doesn't work. Now I want to know, is it possible to drag and drop a button using CCControlbutton. I pasted my code which I have used to create the button.
button1 = CCControlButton::create(CCScale9Sprite::create("7.png"));
button1->setAdjustBackgroundImage(false);
button1->setPosition( ccp(winwsize/6, winhsize/7) );
button1->addTargetWithActionForControlEvents(this, cccontrol_selector(plus::add),CCControlEventTouchDragOutside);
button1->addTargetWithActionForControlEvents(this, cccontrol_selector(plus::add),CCControlEventTouchDragInside);
this->addChild(button1, 4);
In add() I have given the code to enter next scene. But now it is entering while clicking the button. But i want while drag it to one position to another. If it is possible to drag a button using CCControlbutton then please give me some sample codes. Thanks.
The events CCControlEventTouchDragInside and CCControlEventTouchDragOutside are happening when the user's touch (his fingertip) is entering or leaving your button while already or still touching the touchscreen (or while the mouse button is still pressed while the mouse pointer moves).
You would need to observe the dragging process yourself. Starting with a click on your button, change the button's position while the user is dragging (to visualize the dragging process), and then call plus::add() when the dragging ends in your target area.
I must say first - I AM NOT THE PROG OWNER, I don't know how it works and etc, I just need an advice that I could give them.
The program is running on windows based tablet PC with windows 8.
There is some prog that uses OpenGL ES 2.0. It renders some buttons and displays those.
Those buttons can be pressed by mouse left button, but if you use sensor screen, you must tap that button twice for single press.
Shortly - some button displayed.
Mouse left button single click -> button pressed
Single finger tap -> button not pressed
Double finger tap -> button pressed.
I don't understand why that happens. Single tap should imitate single click... Weird.
Anyone have any ideas?
I am not sure about this, but I think this may have something to do with how the program checks if the button is pressed. (long long time ago in my C++ days) If it checks the coordinates on click event then there is a possibility that when you touch the button, it only registers the location of the press, and not the press itself. On the second touch the location is already on the button so the click event is true on that button.
Anyone with more insight please feel free to edit ;-)
I have been trying for a very long time (well a few days) to create a toggle button. A button having a up or down state.
Took over a day to realize it is not possible to create an owner drawn toggle button, a checkbox and pushlike does not work. When using owner drawn there is no difference between a checkbox or regular button (MSDN also notes you cant use owner drawn with any of those styles.)
From reading I found out you have to do it yourself, normally not a problem at all, but I cannot get any real "responsiveness." That is, if I click fast, nothing happens, sometimes I will click and it changes states, other times not and only updates when I click a different button.
I created a global variable for if the button should be shown in up or down state. In the commands I have it set that when the button, IDC_BTN_TOGGLE, it will set the opposite value on the bool.
Then the draw item part:
// button down
if ((pDIS->itemState & ODS_SELECTED) || showButtonDown) {
oldBrush = (HBRUSH)SelectObject(pDIS->hDC, theme.hBrush[BRUSH_BUTTON2]);
}
// button up
else {
oldBrush = (HBRUSH)SelectObject(pDIS->hDC, theme.hBrush[BRUSH_BUTTON]);
}
All my buttons are owner drawn and run through this. showButtonDown is only true when it is drawing IDC_BTN_TOGGLE and the top bool is true as well.
The normal buttons function normally, when I click them, it instantly shows the down state, release, back to normal, the toggle button is barely responsive.
I'm sending mouseclicks to an ActiveX control in C++ one after the other (I'm using AutoDesk Design Review (a CAD system) and sending the clicks to draw an arc).
The only problem I'm having is that if two of the clicks are near each other it registers as a double click.
Is there a value in Windows which determines if the clicks' coordinates make it a double click?
e.g. If the coordinates are less than 10 pixels apart it's a double click, otherwise it's two single clicks.
I cannot intercept the click or cancel the click event in the ActiveX control so I need to stop it firing before.
Many thanks
Alex
The Windows API does provide a way to determine the double-click time and the double-click rectangle:
GetDoubleClickTime() to get the double-click time.
GetSystemMetrics() with the SM_CXDOUBLECLK index to get the rectangle width.
GetSystemMetrics() with the SM_CYDOUBLECLK index to get the rectangle height.
According to the MSDN documentation for mouse input:
Double-Click Messages
The system generates a double-click message when the user clicks a
mouse button twice in quick succession. When the user clicks a button,
the system establishes a rectangle centered around the cursor hot
spot. It also marks the time at which the click occurred. When the
user clicks the same button a second time, the system determines
whether the hot spot is still within the rectangle and calculates the
time elapsed since the first click. If the hot spot is still within
the rectangle and the elapsed time does not exceed the double-click
time-out value, the system generates a double-click message.
This should be sufficient information for detecting double-mouse clicks.
The value by which Windows determines if two clicks are one double or two single clicks is by timing. I don't think there is something in the API that distinguishes them by relative coordinates.