Trackbar and SetGadgetState

Just starting out? Need help? Post your questions and find answers here.
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

srod, I will try your method even though it looks so brutal. FYI: I may be wrong but I thought there would be individual events for "scroll" and "changed". In this specific case I either manually/programatically change the trkbar position and want to capture a "changed" event which is then used to update a text control with the trkbars value. Once done I don't/won't need to consider the text control again, just the trkbar, from where ever I decide to update it from.

Yes I could splatter code around to achieve this or even wrap the SetGadgetState() in a SetTrackBar() proc but in more general cases this becomes messy I suspect it's not needed. Any win gui gods want to comment?
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

srod wins a gold star! Thanks. I will look into the 312.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

It was some kind of changed event that I was looking for. In a way, I wouldn't be surprised if this does not exist in this case, because of, well because of the comments we've all made here.

Certainly the windows message with code 312 seems to fire specifically for the trackbar (in this case) and fires at the desired time. Indeed it seems to fire whenever the control requires some kind of updating; painting etc.

Maybe someone can shed some info on this message.
I may look like a mule, but I'm not a complete ass.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

312 = #WM_CTLCOLORSTATIC
BERESHEIT
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Aha, about the only damn one I didn't try! That explains why it fires when it does.

Strange though, how on earth does a trackbar control fit into the static controls? It's classname is mcstls_trackbar32!
I may look like a mule, but I'm not a complete ass.
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

I noticed this one but it don't make sense for the trkbar.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

It could be a coincidence in that there may well be another window constant, specific to trackbars, with the same value.

At least lParam allows you to differentiate between the controls though.
I may look like a mule, but I'm not a complete ass.
Sub-Routine
User
User
Posts: 82
Joined: Tue May 03, 2005 2:51 am
Location: Wheeling, Illinois, USA
Contact:

Re: Trackbar and SetGadgetState

Post by Sub-Routine »

dmoc wrote:I have a trackbar that is used as an indicator, ie, changed using SetGadgetState(). What EventType/#WM_???? tells me it has changed? I want to update a text control when the bars value changes, possibly from several places so I want to capture an event.


That all seems so complicated to me. If you are using SetGadgetState() why not also use SetGadgetText() next?
dmoc wrote:Another situation is where a trackbar is used for both input and output (at different times).
You should probably create two trackbars (at the same location) and just Hidegadget() the one you are not using.

All IMHO
Rand
We now return to our regularly scheduled programming...
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

@Sub-Routine: thanks for suggestions but solved (see above). I mentioned in a previous post why a do not want to update the text gadget as you suggest. I'm also trying to keep parity with an equivalent c# version (at the moment and as far as practical).
Post Reply