1. Pretend example problem

Hello everyone.

In the Pretend.exw example from Win32lib I attempted to add a PushButton.


-----------------------------------------------------------------------------
-- the gui
constant
Win     = create( Window, "Pretender", 0, Default, Default, WinWide, WinHigh+26,
0 ),
Buffer  = create( Pixmap, "", 0, 0, 0, WinWide, WinHigh, 0 )

constant PushBu8utton3 = create( PushButton, "Hello", Win, 10, 10, 148, 20, 0)
-----------------------------------------------------------------------------
But it does not show up on screen. anyone know why?
Don Cole

new topic     » topic index » view message » categorize

2. Re: Pretend example problem

Later in the code, the Pixmap 'Buffer' is being blitted to the entire screen.

On 10/12/06, don cole <guest at rapideuphoria.com> wrote:
>
>
> posted by: don cole <doncole at pacbell.net>
>
>
> Hello everyone.
>
> In the Pretend.exw example from Win32lib I attempted to add a PushButton.
>
>
> -----------------------------------------------------------------------------
> -- the gui
> constant
> Win     = create( Window, "Pretender", 0, Default, Default, WinWide,
> WinHigh+26, 0 ),
> Buffer  = create( Pixmap, "", 0, 0, 0, WinWide, WinHigh, 0 )
>
> constant PushBu8utton3 = create( PushButton, "Hello", Win, 10, 10, 148, 20,
> 0)
> -----------------------------------------------------------------------------
> But it does not show up on screen. anyone know why?
> Don Cole
>
>
>
>

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

3. Re: Pretend example problem

Greg Haberek wrote:
> 
> Later in the code, the Pixmap 'Buffer' is being blitted to the entire screen.
> 
> On 10/12/06, don cole <guest at rapideuphoria.com> wrote:
> >
> >
> > posted by: don cole <doncole at pacbell.net>
> >
> >
> > Hello everyone.
> >
> > In the Pretend.exw example from Win32lib I attempted to add a PushButton.
> >
> >
> >
> > -----------------------------------------------------------------------------
> > -- the gui
> > constant
> > Win     = create( Window, "Pretender", 0, Default, Default, WinWide,
> > WinHigh+26, 0 ),
> > Buffer  = create( Pixmap, "", 0, 0, 0, WinWide, WinHigh, 0 )
> >
> > constant PushBu8utton3 = create( PushButton, "Hello", Win, 10, 10, 148, 20,
> > 0)
> >
> > -----------------------------------------------------------------------------
> > But it does not show up on screen. anyone know why?
> > Don Cole
> >
> >
Thank you Greg,

So to make the pushButton show up on every tick one must Cut a hole in the
buffer at that point. Or what?

 I appreciate your help  smile


Don Cole

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

4. Re: Pretend example problem

don cole wrote:
> 
> Greg Haberek wrote:
> > 
> > Later in the code, the Pixmap 'Buffer' is being blitted to the entire
> > screen.
> > 
> > On 10/12/06, don cole <guest at rapideuphoria.com> wrote:
> > >
> > >
> > > posted by: don cole <doncole at pacbell.net>
> > >
> > >
> > > Hello everyone.
> > >
> > > In the Pretend.exw example from Win32lib I attempted to add a PushButton.
> > >
> > >
> > >
> > > -----------------------------------------------------------------------------
> > > -- the gui
> > > constant
> > > Win     = create( Window, "Pretender", 0, Default, Default, WinWide,
> > > WinHigh+26, 0 ),
> > > Buffer  = create( Pixmap, "", 0, 0, 0, WinWide, WinHigh, 0 )
> > >
> > > constant PushBu8utton3 = create( PushButton, "Hello", Win, 10, 10, 148,
> > > 20,
> > > 0)
> > >
> > > -----------------------------------------------------------------------------
> > > But it does not show up on screen. anyone know why?
> > > Don Cole
> > >
> > >
> Thank you Greg,
> 
> So to make the pushButton show up on every tick one must Cut a hole in the
> buffer
> at that point. Or what?
> 
>  I appreciate your help  smile
> 

I don't think it's a good idea to have the button overlay the playing area so
I'd place it outisde the playfield. For example, if I put it above the
playfield,...


(a) Add this line after the line 'sequence mountains'

    integer PlayfieldTop

(b) at the beginning of the 'initialize' routine enter these four lines  ...

    sequence btnsize

    btnsize = getRect(Btn)
    PlayfieldTop = btnsize[2] + btnsize[4]
    setClientRect(Win, WinWide, WinHigh + PlayfieldTop)

(c) Replace the two copyBlt() lines with ...

    copyBlt( Win, 0, PlayfieldTop, Buffer )


-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

5. Re: Pretend example problem

> So to make the pushButton show up on every tick one must Cut a hole in the
> buffer at that point. Or what?

Well, you can make the Pixmap the parent of the PushButon, or make the
Windows slightly taller and put it below the Pixmap.

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

6. Re: Pretend example problem

Greg Haberek wrote:
> 
> > So to make the pushButton show up on every tick one must Cut a hole in the
> buffer at that point. Or what?</font></i>
> 
> Well, you can make the Pixmap the parent of the PushButon

Except that Pixmap's don't have parents. Bitmaps do, but not Pixmaps. 


-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

7. Re: Pretend example problem

Derek Parnell wrote:
> 
> don cole wrote:
> > 
> > Greg Haberek wrote:
> > > 
> > > Later in the code, the Pixmap 'Buffer' is being blitted to the entire
> > > screen.
> > > 
> > > On 10/12/06, don cole <guest at rapideuphoria.com> wrote:
> > > >
> > > >
> > > > posted by: don cole <doncole at pacbell.net>
> > > >
> > > >
> > > > Hello everyone.
> > > >
> > > > In the Pretend.exw example from Win32lib I attempted to add a
> > > > PushButton.
> > > >
> > > >
> > > >
> > > > -----------------------------------------------------------------------------
> > > > -- the gui
> > > > constant
> > > > Win     = create( Window, "Pretender", 0, Default, Default, WinWide,
> > > > WinHigh+26, 0 ),
> > > > Buffer  = create( Pixmap, "", 0, 0, 0, WinWide, WinHigh, 0 )
> > > >
> > > > constant PushBu8utton3 = create( PushButton, "Hello", Win, 10, 10, 148,
> > > > 20,
> > > > 0)
> > > >
> > > > -----------------------------------------------------------------------------
> > > > But it does not show up on screen. anyone know why?
> > > > Don Cole
> > > >
> > > >
> > Thank you Greg,
> > 
> > So to make the pushButton show up on every tick one must Cut a hole in the
> > buffer
> > at that point. Or what?
> > 
> >  I appreciate your help  smile
> > 
> 
> I don't think it's a good idea to have the button overlay the playing area so
> I'd place it outisde the playfield. For example, if I put it above the
> playfield,...
> 
> 
> (a) Add this line after the line 'sequence mountains'
> 
>     integer PlayfieldTop
> 
> (b) at the beginning of the 'initialize' routine enter these four lines  ...
> 
>     sequence btnsize
> 
>     btnsize = getRect(Btn)
>     PlayfieldTop = btnsize[2] + btnsize[4]
>     setClientRect(Win, WinWide, WinHigh + PlayfieldTop)
> 
> (c) Replace the two copyBlt() lines with ...
> 
>     copyBlt( Win, 0, PlayfieldTop, Buffer )
> 
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

  Thank you Derek and Greg,
 
What I am really tring to do is place a button in a window with a constantly
moving pixmap. (not a game). I will try Dereks idea of putting a smaller pixmap
in the window and Greg's idea of putting the button below the pixmap.

I haven't tried anything yet as I just got home from work and just read your
posts. I'm tired now and will do it later but I don't see any reason it won't
work.

Thanks again,


Don Cole

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

Search



Quick Links

User menu

Not signed in.

Misc Menu