PDA

View Full Version : trackbar control


matteo.m
01-18-2007, 07:34 PM
I add a trackbar control on a form.
if i add the OnPosChanging events to the control, this will cause a syntax error on the run or compile. Thanks

PointOfLight
01-19-2007, 04:42 AM
For now, add the following in your main ppl file before the include for the form:

#define WM_WINDOWPOSCHANGING 0x46

Kornalius, could you add this to the file with the WM_ constants?

[Edit]

Actually, that fixed the compilation problem, but that didn't seem to be enough to actually get the event to fire.

matteo.m
01-19-2007, 06:04 AM
Hi Eric, yes i confirm, the event dont fire, also the OnPosChanged looks like dont fire too.

PointOfLight
01-19-2007, 01:27 PM
Just to confirm, these two events don't work on either the desktop or PPC.

kornalius
01-19-2007, 04:30 PM
Apparently you are not using the right events. Check the following page:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/trackbar/trackbar.asp

A WM_HSCROLL or WM_VSCROLL message is sent to the parent window. So I have added the two messages to the form and then you can put the event code on the form's OnHScroll or OnVScroll events.

This will all be working in 1.12 I have got it to work. Not very nice but Windows API decided it was like that.

kornalius
01-19-2007, 04:35 PM
Here is the code I have used:

func FORM100_OnHScroll(hWnd$, Msg$, wParam$, lParam$)
HandleEventParms
Global(z$);
if (lParam$ == Trackbar101$)
Label_Set(Label102$, Trackbar_Get(lParam$));
end;
return (true);
end;

I put this code on the form OnHScroll. The lParam$ will contain the trackbar handle.

This will all be possible later today with 1.12.

matteo.m
01-19-2007, 06:50 PM
Thanks Alain, I readed the microsoft link and now is clear that i'm not suppose to use that event into a trackbar control. You think that could be possible when you select a control in the pide, to see in the event tab, the event you are supposed to use for that control painted in a green or different color? That could help beginner and newbie. Thanks [EDIT] But anyway dont help in a case like this one... so... i dont know if this suggestion can really help or not... hummm ...

PointOfLight
01-19-2007, 07:38 PM
Actually, OnPosChanging is a perfectly valid event for the trackbar control. It just doesn't mean what we think it did. The event actually gets fired when you move the control around the screen. Of course, now that I think about it, it does kind of make sense. Anyway, can you still add

#define WM_WINDOWPOSCHANGING 0x46

to the appropriate ppl include?

kornalius
01-19-2007, 07:44 PM
It has been added Eric in 1.12.

matteo.m
01-19-2007, 07:48 PM
HAHA right Eric the event dont mean what we had in mind... that is so true...