[futurebasic] Re: [FB] Image not showing in HIImageView

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2012 : Group Archive : Group : All Groups

From: Brian S <fblistserve@...>
Date: Sat, 28 Jan 2012 16:28:08 -0700
> For any interested, the test code is:
btw: there are some coding faux paws in the test code, so please check code folks; It is not finished code. For example, there is no error checking for the WindowRef and code would typically make sure the window wasn’t previously created. 


> local fn BuildAboutWnd
> '~'1
> dim as WindowRef          w
> dim as OSStatus           err 
> dim as HIRect             viewRect, bounds
> dim as HIViewRef          imageView, contentView
> dim as CGImageRef         image
> 
> err = fn NibCreateWindow( @"About", @"Window", @w )
> viewRect = fn CGRectMake( 150.0, 00.0, 100.0, 100.0 )
> fn HIViewFindByID( fn HIViewGetRoot( w ), kHIViewWindowContentID, @contentView )
> image = fn CreateCGImageFromBundleResource( @"VMT.icns" ) // or .png or .jpg etc.
> fn HIImageViewCreate ( image, @imageView )
> CGImageRelease( image )
> 
> // these 4 calls from Steve V.V. demos
> fn HIViewSetFrame ( imageView, @viewRect )
> fn HIViewSetVisible( imageView, _true )
> fn HIImageViewSetScaleToFit( imageView, _true )
> fn HIViewAddSubview ( contentView, imageView )
> 
> ShowWindow( w )
> end fn
> 
> fn BuildAboutWnd
> RunApplicationEventLoop()
> '-------------
> 
> Brian S
> 
> 
> 
> 
> 
> 

Brian S