Is this possible?


09-12-2007 12:21:46

Is this possible with a single click with quickGUI? ... ionuf4.jpg


09-12-2007 22:42:56

Easily done. 8)

Just make a ProgressBar widget, skin it to what you've shown, and add an event such that on Left Mouse Button down, you calculate the horizontal percentage of the cursor position vs the ProgressBar position. If you wanted to support LMB down and drag the value, you would want to add an event handler for DRAGGED.

The operations needed to do it are a little advanced, but I can help you out.


10-12-2007 09:41:36

when i saw this post i tryed to do what you say, but when i add an event handler with addEventHandler() and set the event as mouse button down, and pass the function for the handler, the compiler gives me an error...


10-12-2007 09:59:14

ok!, Already finished energy bar
how is the draged?
Pd: tanks


10-12-2007 17:33:44

@Artic_Ice83: Hopefully you solved this, from the other thread.



This enables/simulates dragging, but actually performs no dragging, since the dragging widget is NULL. 8)

For determining the position of the mouse cursor relative to the location of the progress bar, make sure you're using the following functions:


The AbsolutePosition reveals the true pixel coordinates on the screen, for example if your ProgressBar is inside a container that can scroll.


10-12-2007 21:47:27

yes, i solved it. it was an error in the event name.
when i call setDraggingWidget(), what kind of widget i have to pass to the function?


10-12-2007 22:04:36

Any widget you want! It would probably make send to pass the same instance of the widget and set that as the dragging widget.

Basically, when you click and drag the mouse over a widget, it will drag the draggingWidget.


The titlebar's parent is the window, so clicking and dragging the titlebar will drag the window, which moves the title bar. You could also do weird things, where clicking and dragging over an object will drag another object. If you want a simple case, where you can drag a button around, you would do



10-12-2007 22:57:09

finally i did it! but instead of an event type DRAGGED, i used an EVENT_MOUSE_BUTTON_DOWN. The handler function get the position of the mouse, the actual position of the progress bar and the width. than sets the progress on the base of the position of the mouse relatively both position of the widget and its width.
but i didn't use the function getAbsolutePosition because i don't find it in my functions list. i've called the getActualPosition of the widget....but i suppose that if the widget is in a window or panel this call doesn't return the wanted result...


10-12-2007 23:20:03

My mistake, its probably getActualPosition. :oops:

getActualPosition returns the pixel coordinates as it is shown on the screen, with 0,0 being the top left of the render window. So for example, it will tell you where a widget is between 0,0 to 800,600, or whatever your resolution is.

Setting the progress by clicking is a cool idea. Not unheard of, but I'm happy the current code base supports this without any addition, it means I've made things pretty flexible with minimal assumptions. 8)


11-12-2007 00:15:33

Everything works fine!
i love QuickGUI