realbasic-nug
[Top] [All Lists]

Re: Width of QT Controller

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Width of QT Controller
From: "Scott Crick (Lists)" <lists at swssoftware dot com>
Date: Wed, 27 Feb 2002 18:42:10 -0600
On 2/24/02 4:53 PM, "Kevin Ballard" <kevin at sb dot org> wrote:

> On 2/24/02 5:43 PM, "Scott Crick (Lists)" <lists at swssoftware dot com> 
> wrote:
> 
>> So the question arises, if this is true that this can't be done with
>> Declares in RB, is it something that REALbasic is doing with moviePlayers
>> behind the scenes? What is preventing this from working in REALbasic?
> 
> I'd guess it's something RB is doing behind the scenes. You can ask Joe,
> though. Maybe he'll answer tomorrow when he's back on duty.

Well, with Erick Tejkowski's help, I've managed to come up with some code
that successfully resizes a MovieControls controller without resizing the
movie.

The following is the code (watch for line-wraps):

  dim mb As MemoryBlock
  dim i As Integer
  dim f as folderItem
  dim w as integer
  dim h as integer
  #If TargetMacOS then
  #If TargetCarbon then
  Declare Function MCIsControllerAttached Lib "Apple;Carbon;Multimedia" (mc
as Integer) as Integer
  Declare Function MCGetControllerBoundsRect Lib "Apple;Carbon;Multimedia"
(mc as Integer, bnds as ptr) as Integer
  Declare Function MCSetControllerBoundsRect Lib "Apple;Carbon;Multimedia"
(mc as Integer, bnds as ptr) as Integer
  Declare Function MCSetControllerAttached Lib "Apple;Carbon;Multimedia" (mc
as integer, attach as Integer) as Integer
  #else
  Declare Function MCIsControllerAttached Lib "QuickTimeLib" (mc as Integer)
as Integer
  Declare Function MCGetControllerBoundsRect Lib "QuickTimeLib" (mc as
Integer, bnds as ptr) as Integer
  Declare Function MCSetControllerBoundsRect Lib "QuickTimeLib" (mc as
Integer, bnds as ptr) as Integer
  Declare Function MCSetControllerAttached Lib "QuickTimeLib" (mc as
integer, attach as Integer) as Integer
  #endif
  #else
  Declare Function MCIsControllerAttached Lib "qtmlClient.dll" (mc as
Integer) as Integer
  Declare Function MCGetControllerBoundsRect Lib "qtmlClient.dll" (mc as
Integer, bnds as ptr) as Integer
  Declare Function MCSetControllerBoundsRect Lib "qtmlClient.dll" (mc as
Integer, bnds as ptr) as Integer
  Declare Function MCSetControllerAttached Lib "qtmlClient.dll" (mc as
integer,
attach as Integer) as Integer
  #endif
 
  // Resize the window according to size of movie.
  // Note that here and below, I've hardwired the size of the grow box and
  // QTcontroller. This is just to make the code more compact for testing.
  w = self.width
  h = self.height
  
  mb = newMemoryBlock( 8 ) // Define the rect for the controller
  
  // Get the current bounds of the controller rect.
  i = MCGetControllerBoundsRect( player.qtMovieController, mb )
  mb.short( 6 ) = w - 15
  mb.short( 0 ) = h - 15
  
  // According to QTUtilities.c (ref.
http://developer.apple.com/samplecode/Sample_Code/QuickTime/Goodies/QTContro
ller.htm)
  // we need to unattach the QTcontroller first. Otherwise, we will affect
the entire movie.
  i = MCSetControllerAttached( player.qtMovieController, 0 )
  
  // Now attempt to set the new controller bounds.
  i = MCSetControllerBoundsRect( player.qtMovieController, mb )
  


This works great. The problem now is, once you have resized the
controller-bar, it is impossible to resize the movie control (via code or by
dragging a window with the controls edges locked). I have not been able to
find a workaround for this.

However, I pass on this code in the hopes that others might find it useful,
and maybe figure out a workaround that will still allow the movie control to
be resized afterwards.

Scott
-- 
SearchWare Solutions
Simply Great Software
http://www.swssoftware.com



<Prev in Thread] Current Thread [Next in Thread>