[Gambas-user] Moving things

nic dent.nic at ...626...
Mon Jul 27 23:33:03 CEST 2009


Ok, thanks! I replaced all the "btnExit"s with Button1, the name of my
button. I have a textbox set to receive the keypresses, but hopefully I will
come up with a better solution. But it works! Thanks Dimtiris and Charles!

On Mon, Jul 27, 2009 at 1:25 PM, Dimitris Anogiatis <dosida at ...626...>wrote:

> Nic,
>
> btnExit refers to a button control that is called btnExit. From the name I
> can infer that it's an exit button
> What the code does is when you have the focus on that button and you press
> the up button on your
> keyboard the button will jump 10 pixels up from its current position and if
> you press the down button
> on your keyboard it will jump 10 pixels down from its current position.
>
> for this code to work you must have a button control on your form named
> btnExit. Then if you paste
> it, it'll work.
>
> Hope this helps
>
> Regards
> Dimtiris
>
> On Mon, Jul 27, 2009 at 1:50 PM, nic <dent.nic at ...626...> wrote:
>
> > Well, I tried the code, but an error message pops up and tells me that
> > "btnExit" is an unknown identifier. To be specific, it means this one:
> >
> > PUBLIC SUB btnExit_KeyPress()
> >  SELECT CASE Key.Code
> >   CASE Key.Up
> >
> >     >>>>>btnExit.y = btnExit.y - 10
> >
> >   CASE Key.Down
> >     btnExit.y = btnExit.Y + 10
> >  END SELECT
> > END
> >
> > I would try and figure this out on my own, but I am still fairly new to
> > computer programming. Thanks!
> >
> > On Sat, Jul 25, 2009 at 6:29 PM, nic <dent.nic at ...626...> wrote:
> >
> > > Cool! Thanks! This will definitely help in my game :D
> > > thanks
> > >
> > >
> > > On Sat, Jul 25, 2009 at 3:44 AM, charlesg <
> charles at ...1784...
> > >wrote:
> > >
> > >>
> > >> Hi
> > >>
> > >> Quick? Easy? Depends on where you are looking from :)
> > >> '----------------------------------
> > >> PUBLIC SUB btnExit_KeyPress()
> > >>  SELECT CASE Key.Code
> > >>    CASE Key.Up
> > >>      btnExit.y = btnExit.y - 10
> > >>    CASE Key.Down
> > >>      btnExit.y = btnExit.Y + 10
> > >>  END SELECT
> > >> END
> > >> '---------------------------------
> > >> similar for left and right.
> > >> you would also have to check that the button (or whatever) has not
> moved
> > >> out
> > >> of bounds (by comparing with the Form boundaries)
> > >> Obviously the focus does not have to be the button itself. You can
> > control
> > >> it say from a hidden textBox.
> > >>
> > >> rgds
> > >> --
> > >> View this message in context:
> > >> http://www.nabble.com/Moving-things-tp24654731p24656776.html
> > >> Sent from the gambas-user mailing list archive at Nabble.com.
> > >>
> > >>
> > >>
> > >>
> >
> ------------------------------------------------------------------------------
> > >> _______________________________________________
> > >> Gambas-user mailing list
> > >> Gambas-user at lists.sourceforge.net
> > >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> > >>
> > >
> > >
> >
> >
> ------------------------------------------------------------------------------
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list