Skip to main content

Microsoft Silverlight

Answered Question Layout design questionRSS Feed

(0)

ScCrow
ScCrow

Member

Member

44 points

107 Posts

Layout design question

I’m embarrassed to ask this question, but I am missing some basic concept.

I have created a user control that is going to use key presses to change the position of an object on the screen (yes, a game). The main game page has a 3x3 grid.  The center grid then loads a user control for the game.  As probably with any game, the intent is that in the main game page, then we have places for navigation, menus, and other non-game related items such as an ad rotator. 

On the second page, I need to have buttons to press to reset things, reload, messages, etc.  The actual canvas for the game would be in the center of the grid again.

So, in the 2nd project, the first level of this is a Canvas which in turn has a 3x3 grid.  The center of this grid will contain another canvas that contains my game area.  On the top of page 2 (grid 0,1)  I have a button.  In the center of the grid, I have a canvas.  Here I will move a rectangle around within the bounds of the canvas. The 1st level canvas has a Keydown event and a handler (only place it works). If I set the 2nd project as the startup project, the game seems to work.  If I press the left arrow, it moves left. Right arrow, it moves right. But... there is always one isn’t there.  If I press the spacebar, it executes the event for the button that sits in row 0,1 and not the Keydown event.   Additionally, if I try to run this from the main page, or anywhere else, it doesn’t accept the keystrokes.  I tried moving the game grid to yet another user control, but that didn’t work.  Well, hasn’t worked yet. 

So, I have been looking around, and so far have not seen the solution.  Most of the things I find use mouse clicking, in silverlight 1.1, etc.  

I know it’s a simple design mistake, but I’m not seeing it.  I don’t think this requires a game loop, but then perhaps it does. 

This is done using VB.

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24939 points

2,425 Posts

Microsoft
Answered Question

Re: Layout design question

 Hi ScCrow,

Would you please share a simple repro here?   Similar issues may be easier to find out the real cause with some simple codes.

Best regards,

Jonathan

 

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

ScCrow
ScCrow

Member

Member

44 points

107 Posts

Re: Layout design question

Jonathan

 I am going to mark this as answered and open a new post as I can now pose a much better question as to my problem.  That should make for a better search for anyone else having a similar problem.

Thanks 

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities