Current location: Hot Scripts Forums » Programming Languages » Windows .NET Programming » Window inside a Window with thread? without thread ?


Window inside a Window with thread? without thread ?

Reply
  #1 (permalink)  
Old 12-07-09, 08:32 PM
drah drah is offline
New Member
 
Join Date: Dec 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Window inside a Window with thread? without thread ?

I did like some advices on this little project i am trying to do so i will start explainning a little what it is.

What i am planning to do is a 2 windows application where the first window will hold configurations, database edition, etc... and the second window will display the information of something when you have your mouse over it.

So right now what i am trying to do is something really basic... First something i am not sure about is how should i create this second window.

Should i just create the new form in the public autox function and then reuse it on the thread process or should i create it inside the thread ? but then again if i create it inside the thread how should i manage it ?

Here is a little sample of my main window, it has no content but the checkbox that begins false and changes to true once u check it.

then you can see that i am defining and calling my thread and it is function which what i wanted to do with that function basicly is if the checkBox is check the window will be display if it is uncheck it will hide.

But since on the future i will have data being updated in there and that data will be called after reading another process i tought that it did be better having it on a thread so i could still do or manage other stuffs within the application.
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace AutoX
{
    public partial class AutoX : Form
    {
        bool run = true;
        Thread WindowShowHide;

        public AutoX()
        {
            InitializeComponent();

            WindowShowHide = new Thread(new ThreadStart(WindowInfo));
            WindowShowHide.Start();
        }

        public void WindowInfo()
        {
            while (run == true)
            {
                if (iOnMouseBox.ThreeState == false)
                {
                    ShowItem.Show();
                }
                else
                {
                    ShowItem.Hide();
                }
            }
        }
    }
}
Here is my second window which at the momment has no content... i just want to be able to do what i said above
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AutoX
{
    public partial class ShowItem : Form
    {
        public ShowItem()
        {
            InitializeComponent();
        }
    }
}
looking forward to any tips, advices etc ...

Even if i am doing something wrong if you can atleast point me on the right direction it would be awesome.

Thanks in advance.

PS if u need any additional code please let me know and i will post here.
Reply With Quote
  #2 (permalink)  
Old 12-08-09, 07:32 AM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
Are you using threading to make your application Asynchronous (i.e. allow multiple tasks to run at the same time)? If so I recommend that you read the MSDN Threading tutorial at:

Threading Tutorial (C#)

There are some examples you can follow to get the hang of threading in general.

Pete
__________________
Reply With Quote
  #3 (permalink)  
Old 12-08-09, 01:29 PM
drah drah is offline
New Member
 
Join Date: Dec 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
hi,

thanks for the information as it is never enough but the thread is working fine ...

i guess what i am having trouble with is how i am calling the form and such ... perhaps i could be calling the 2nd form outside the thread and delegate/invoke to update it ... not suere where to go from here... with the windows.

And yes i did like to be performing more then 1 action at the same time...

But for now i am just trying to get the best handdle of this part working properly...

You check the checkbox and the 2nd window open, you uncheck it and it closes / hide.
When you have your mouse over something the data inside the 2nd form updates ...
that is all.

I did like the checkbox to respond as fast as possible so i tought it did better be into a thread but im not sure how to handdle the 2nd window if i should put it within the thread etc..
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open a new window in firefox by clicling on a link inside a flash pop up oursvince Flash & ActionScript 5 11-16-07 06:13 AM
Opening a link in a window in another window, which is already open. andr345 JavaScript 1 06-15-06 03:25 AM
popup brower pai Flash & ActionScript 3 05-17-06 09:28 PM
[Help] Javascript pop up window with background color empty.container JavaScript 1 01-13-05 03:11 AM


All times are GMT -5. The time now is 02:19 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.