This project is read-only.

Can't get ForEach to work as suggested on MSDN (No interfaces)

Sep 10, 2011 at 3:19 PM

I am making a window system and I need to know why this code doesn't work, maybe it isn't the foreach but it just won't work

mx = mousex

my = mousey

tly = top left y

tlx = top left x

foreach(Window w in activewindows)
            {
                if (Program.mx > (uint)w.windowright - 6 && Program.mx < (uint)w.windowright && Program.my > w.tly && Program.my < w.titlebottom)
                {
                    CloseWindow(w);
                }
            }

Also if anyone can help out with this below

I have two buttons on my shutdown dialog (yes and no) and am using the following to see if there is a click while they are active it is not working either

names = name property of the window

activewindows[] = array to store windows

mx, my, tlx, tly as above

if (Mouse2.Buttons == Mouse2.MouseState.Left)
           {
if(windows.activewindows[0].names == "shutdown")
                {
                    if (mx > windows.activewindows[0].tlx + 23 && mx < windows.activewindows[0].tlx + 50 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38)
                    {
                        Cosmos.Sys.Deboot.ShutDown();
                    }
                    if (mx > windows.activewindows[0].tlx + 54 && mx < windows.activewindows[0].tlx + 74 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38)
                    {
                        windows.CloseWindow(syswindows.shutdownwindow);
                    }
                }
           }

Help is much appreciated

 

Thanks

 

melikesPCcheese

Sep 10, 2011 at 5:12 PM
interfaces are not supported. in some situations foreach works, but best to use a for loop instead fo rnow..


On Sat, Sep 10, 2011 at 4:19 PM, melikesPCcheese <notifications@codeplex.com> wrote:

From: melikesPCcheese

I am making a window system and I need to know why this code doesn't work, maybe it isn't the foreach but it just won't work

mx = mousex

my = mousey

tly = top left y

tlx = top left x

foreach(Window w in activewindows)
            {
                if (Program.mx > (uint)w.windowright - 6 && Program.mx < (uint)w.windowright && Program.my > w.tly && Program.my < w.titlebottom)
                {
                    CloseWindow(w);
                }
            }

Also if anyone can help out with this below

I have two buttons on my shutdown dialog (yes and no) and am using the following to see if there is a click while they are active it is not working either

names = name property of the window

activewindows[] = array to store windows

mx, my, tlx, tly as above

if (Mouse2.Buttons == Mouse2.MouseState.Left)
           {
if(windows.activewindows[0].names == "shutdown")
                {
                    if (mx > windows.activewindows[0].tlx + 23 && mx < windows.activewindows[0].tlx + 50 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38)
                    {
                        Cosmos.Sys.Deboot.ShutDown();
                    }
                    if (mx > windows.activewindows[0].tlx + 54 && mx < windows.activewindows[0].tlx + 74 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38)
                    {
                        windows.CloseWindow(syswindows.shutdownwindow);
                    }
                }
           }

Help is much appreciated

Thanks

melikesPCcheese

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Sep 10, 2011 at 6:30 PM

Also, look into using something like the BoundingBox class in Orvid.Graphics. Trust me, you'll be very, very, glad you did :P

Sep 11, 2011 at 1:27 PM

ok thanks for that but this still doesn't work

if (Mouse2.Buttons == Mouse2.MouseState.Left)
           {
if(windows.activewindows[0].names == "shutdown")
                {
                    if (mx > windows.activewindows[0].tlx + 23 && mx < windows.activewindows[0].tlx + 50 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38)
                    {
                        Cosmos.Sys.Deboot.ShutDown();
                    }
                    if (mx > windows.activewindows[0].tlx + 54 && mx < windows.activewindows[0].tlx + 74 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38)
                    {
                        windows.CloseWindow(syswindows.shutdownwindow);
                    }
                }
           }

// and the new code i wrote doesn't work either, it is in the window class and called when a left click is made.


    public void CloseButtonClickCheck()
        {
            if (Program.mx > (uint)windowright - 6 && Program.mx < (uint)windowright && Program.my > tly && Program.my < titlebottom)
            {
                windows.CloseWindow(this);
            }
        }


Sep 11, 2011 at 2:09 PM
So what happens now?

On Sun, Sep 11, 2011 at 2:27 PM, melikesPCcheese <notifications@codeplex.com> wrote:

From: melikesPCcheese

ok thanks for that but this still doesn't work

if (Mouse2.Buttons == Mouse2.MouseState.Left) { if(windows.activewindows[0].names == "shutdown") { if (mx > windows.activewindows[0].tlx + 23 && mx < windows.activewindows[0].tlx + 50 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38) { Cosmos.Sys.Deboot.ShutDown(); } if (mx > windows.activewindows[0].tlx + 54 && mx < windows.activewindows[0].tlx + 74 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38) { windows.CloseWindow(syswindows.shutdownwindow); } } }

// and the new code i wrote doesn't work either, it is in the window class and called when a left click is made.


    public void CloseButtonClickCheck()
        {
            if (Program.mx > (uint)windowright - 6 && Program.mx < (uint)windowright && Program.my > tly && Program.my < titlebottom)
            {
                windows.CloseWindow(this);
            }
        }


Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Sep 11, 2011 at 9:16 PM
I'm still confused this code should work but doesn't, any ideas why?

Sent from my iPod via Hands, Eyes and Brain

On 11 Sep 2011, at 14:09, "mterwoord"<notifications@codeplex.com> wrote:

From: mterwoord

So what happens now?

On Sun, Sep 11, 2011 at 2:27 PM, melikesPCcheese <notifications@codeplex.com> wrote:

From: melikesPCcheese

ok thanks for that but this still doesn't work

if (Mouse2.Buttons == Mouse2.MouseState.Left) { if(windows.activewindows[0].names == "shutdown") { if (mx > windows.activewindows[0].tlx + 23 && mx < windows.activewindows[0].tlx + 50 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38) { Cosmos.Sys.Deboot.ShutDown(); } if (mx > windows.activewindows[0].tlx + 54 && mx < windows.activewindows[0].tlx + 74 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38) { windows.CloseWindow(syswindows.shutdownwindow); } } }

// and the new code i wrote doesn't work either, it is in the window class and called when a left click is made.


    public void CloseButtonClickCheck()
        {
            if (Program.mx > (uint)windowright - 6 && Program.mx < (uint)windowright && Program.my > tly && Program.my < titlebottom)
            {
                windows.CloseWindow(this);
            }
        }


Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Sep 12, 2011 at 7:29 AM
Please answer my question and i'll give some response.

On Sun, Sep 11, 2011 at 10:16 PM, melikesPCcheese <notifications@codeplex.com> wrote:

From: melikesPCcheese

I'm still confused this code should work but doesn't, any ideas why?

Sent from my iPod via Hands, Eyes and Brain

On 11 Sep 2011, at 14:09, "mterwoord"<notifications@codeplex.com> wrote:

From: mterwoord

So what happens now?

On Sun, Sep 11, 2011 at 2:27 PM, melikesPCcheese <notifications@codeplex.com> wrote:

From: melikesPCcheese

ok thanks for that but this still doesn't work

if (Mouse2.Buttons == Mouse2.MouseState.Left) { if(windows.activewindows[0].names == "shutdown") { if (mx > windows.activewindows[0].tlx + 23 && mx < windows.activewindows[0].tlx + 50 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38) { Cosmos.Sys.Deboot.ShutDown(); } if (mx > windows.activewindows[0].tlx + 54 && mx < windows.activewindows[0].tlx + 74 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38) { windows.CloseWindow(syswindows.shutdownwindow); } } }

// and the new code i wrote doesn't work either, it is in the window class and called when a left click is made.


    public void CloseButtonClickCheck()
        {
            if (Program.mx > (uint)windowright - 6 && Program.mx < (uint)windowright && Program.my > tly && Program.my < titlebottom)
            {
                windows.CloseWindow(this);
            }
        }


Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Sep 12, 2011 at 3:49 PM
The window class now has a method which checks to see if the close button was clicked on. It is called everytime a left click is detected in the main loop.

Also the top code is to see if a yes or no button is clicked in the shutdown dialog.

This code should work but doesn't do you have any ideas why?

Sent from my iPod via Hands, Eyes and Brain

On 12 Sep 2011, at 07:29, "mterwoord"<notifications@codeplex.com> wrote:

From: mterwoord

Please answer my question and i'll give some response.

On Sun, Sep 11, 2011 at 10:16 PM, melikesPCcheese <notifications@codeplex.com> wrote:

From: melikesPCcheese

I'm still confused this code should work but doesn't, any ideas why?

Sent from my iPod via Hands, Eyes and Brain

On 11 Sep 2011, at 14:09, "mterwoord"<notifications@codeplex.com> wrote:

From: mterwoord

So what happens now?

On Sun, Sep 11, 2011 at 2:27 PM, melikesPCcheese <notifications@codeplex.com> wrote:

From: melikesPCcheese

ok thanks for that but this still doesn't work

if (Mouse2.Buttons == Mouse2.MouseState.Left) { if(windows.activewindows[0].names == "shutdown") { if (mx > windows.activewindows[0].tlx + 23 && mx < windows.activewindows[0].tlx + 50 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38) { Cosmos.Sys.Deboot.ShutDown(); } if (mx > windows.activewindows[0].tlx + 54 && mx < windows.activewindows[0].tlx + 74 && my > windows.activewindows[0].tly + 24 && my < windows.activewindows[0].tly + 38) { windows.CloseWindow(syswindows.shutdownwindow); } } }

// and the new code i wrote doesn't work either, it is in the window class and called when a left click is made.


    public void CloseButtonClickCheck()
        {
            if (Program.mx > (uint)windowright - 6 && Program.mx < (uint)windowright && Program.my > tly && Program.my < titlebottom)
            {
                windows.CloseWindow(this);
            }
        }


Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com