1. RE: Splash : Derek Parnell

It works for me.  I ran it in a directory without splash.bmp and got a 
blank rectangle.  Then I tossed a splash.bmp into the same directory.  
It showed in the window.  So I guess, check to make sure your bitmap is 
where you think it is.
Evan Marshall wrote:
> I have here a slightly modified bit of code that I found on the forum.
> When I run it, all that I get is a grey rectangle.  What am I doing
> wrong?
> ---------------------------------------------
> include win32lib.ew
> 
> constant MainWindow = create(Window, "MainWindow", 0, 0, -100, 0, 0,
> 0),
> Splash = create(Window, "Splash", 0, 0, 0, 0,
> 0,{WS_POPUP,WS_VISIBLE}),
> SBM = create(Bitmap, "", Splash, 0, 0, 800, 600, 0)
> 
> procedure initialize()
> 
> atom timeout
> 
> -- Set 5 seconds as the minimum time for a splash window display.
>     timeout = time() + 5
> -- Draw the stuff on the splash screen.
>     setBitmap(SBM, "splash.bmp")
> -- Move it back into view
>     setRect(Splash, 100, 100, 800, 600, 1)
> -- Wait til countdown has elapsed.
>     while timeout > time() do
>         doEvents(0)
>     end while
> -- Get rid of splash screen.
>     destroy(Splash)
> 
> 
> end procedure
> 
> onActivate[MainWindow] = routine_id("initialize")
> 
> WinMain( MainWindow, Normal )
> 
>

new topic     » topic index » view message » categorize

2. RE: Splash : Derek Parnell

Hi Evan,
this works for me. You might like to check that the bitmap is in the current
directory though. 

To make it a bit more "bullet-proof", try something like...


   atom BMP

   BMP = loadBitmapFromFile("splash.bmp")
   if BMP = 0 then
     -- No file loaded.
   else
      setBitmap(SBM, BMP)
   end if
 .
 .
 .
   destroy(Splash)
   deleteObject(BMP)
 end procedure

----------
Derek


--------------------------------------------------------------------
CAUTION - This email and any files attached may contain privileged and
confidential information intended solely for the use of the individual or
entity to whom they are addressed. If you are not the intended recipient of
this message you are hereby notified that any use, dissemination,
distribution or reproduction of this message is prohibited. If you have
received this message in error please notify the sender immediately. Any
views expressed in this message are those of the individual sender and may
not necessarily reflect the views of Global Technology Australasia Limited.
--------------------------------------------------------------------

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu