Author Topic: Code question  (Read 10248 times)

Rex

  • Guest
Code question
« on: 18 Jun '03 - 16:40 »
Anyone know how to add that "dragging" capability to my program, just like XMPlay when it drags the playlist-window to the right? I would be real grateful if someone helped me out with this!

Thanks in advance, Rex.

WinWon

  • Guest
Re: Code question
« Reply #1 on: 18 Jun '03 - 17:16 »
Hm, I think you should use the SendMessage() API to do that.

Rex

  • Guest
Re: Code question
« Reply #2 on: 18 Jun '03 - 17:54 »
Please can't someone atleast give me an idea/suggestion on how to do that?

DanaPaul

  • Posts: 335
Re: Code question
« Reply #3 on: 18 Jun '03 - 18:25 »

Quote
Anyone know how to add that "dragging" capability to my program, just like XMPlay when it drags the playlist-window to the right?


This isn't the forum for such a question.  However, I personally feel that XMPlay does a good job with this functionality rather than other media applications that utilize a timer and a scrolling portion of a window size.  I loathe timers and waiting for anything so boring, eh? :)

You would need to process wm_MouseDown messages and re-calculate window/control width(s) while using API SetWindowPos to adjust sizes on the fly.

Rex

  • Guest
Re: Code question
« Reply #4 on: 18 Jun '03 - 18:41 »
Heh well you're right and I'll use a subclass that will handle WM_LBUTTONDOWN messages to try to do it :)

Thanks, Rex.

Sebastian Andersson

  • Posts: 372
Re: Code question
« Reply #5 on: 18 Jun '03 - 18:50 »
You should use SendMessage(hwnd,0xA1,15,0); to complete that task I think. Hope it works :D

DanaPaul

  • Posts: 335
Re: Code question
« Reply #6 on: 18 Jun '03 - 20:55 »

Quote

You should use SendMessage(hwnd,0xA1,15,0); to complete that task I think. Hope it works :D


Actually, "Send" message would not bring a desired effect, and may cause an infinite loop.  "Post" message on the other hand would have the calling function returning without waiting for a result. For that reason, I believe you will find that a combination of wm_ButtonDown and wm_MouseMove processing would allow you to size the window using SetWindowPos (no wm_Messages!) without causing the app to hang or loop infinitly.

Rex

  • Guest
Re: Code question
« Reply #7 on: 18 Jun '03 - 21:33 »
Yeah, maybe if I use PostMessage instead of SendMessage it will work. Btw DanaPaul you got any sample code or something that I can start to build/work from? The code can be in any language.

Thanks to everyone of ya, Rex.

DanaPaul

  • Posts: 335
Re: Code question
« Reply #8 on: 18 Jun '03 - 22:35 »

Quote
Btw DanaPaul you got any sample code or something that I can start to build/work from? The code can be in any language.


Generally, this code will be spread out amongst many methods/handlers.  But any Splitter control (dynamically re-size controls) or header control (dynamically re-size Columns) should give you a good starting point and an example that is specific to your visual object oriented language (if any).

Ian @ un4seen

  • Administrator
  • Posts: 26102
Re: Code question
« Reply #9 on: 18 Jun '03 - 23:12 »
The way it's done in XMPlay is with multiple windows (ie. one for each panel) = no resizing/reshaping involved, just moving, which is of course quicker and simpler... the real tricky bit is the Z-ordering of the windows :)

DanaPaul

  • Posts: 335
Re: Code question
« Reply #10 on: 19 Jun '03 - 00:38 »

Quote

The way it's done in XMPlay is with multiple windows (ie. one for each panel) = no resizing/reshaping involved, just moving, which is of course quicker and simpler...


The playlist window could never be any wider than the main window, eh?

Quote
the real tricky bit is the Z-ordering of the windows :)


API SetWindowPos has a parameter for z-ordering flags :)


Rex

  • Guest
Re: Code question
« Reply #11 on: 19 Jun '03 - 10:20 »
Thanks to all of ya :) Heh I could never figure out it used multiple windows lol :P Well I hope I'll get it working ;) Thanks again :)

Rex.

Ian @ un4seen

  • Administrator
  • Posts: 26102
Re: Code question
« Reply #12 on: 19 Jun '03 - 14:05 »
Quote

The playlist window could never be any wider than the main window, eh?

Yep. But that's actually a good thing, as it allows skin designs where the side panels show through spaces in the main panel.

Quote

API SetWindowPos has a parameter for z-ordering flags :)

Yep, but Windows likes to move them around once you start clicking on them, so you have to keep enforcing the order... the fun really begins when you add other windows/dialogs into the mix :)

Ralesk

  • Posts: 652
Re: Code question
« Reply #13 on: 25 Jun '03 - 23:50 »
... and when Windows decides to choke on a handful of alwaysontop windows and meass around with window orders just for the hell of it :P