|
Hi all,
I'm trying to create a few panels in a VC++.net application. I need the panels to be visible on a number of screens and I don't want to reproduce the same components many times over. When I run my app the panel is only visible in one screen only no matter what I do.
I'm doing something along the lines of
<br />
private: System::Void application_menuItem_Click(System::Object * sender, System::EventArgs * e)<br />
{<br />
this->application_panel->Visible = true;<br />
this->low_level_panel->Visible = false;<br />
}<br />
which works for one screen but not if I select any other screen.
Any ideas gratefully recieved.
|
|
|
|
|
What do you mean by a screen ? A form ? How does this panel get to be on these forms ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sorry for the poor explanation.
I have a form (Form1), that has two panels on (panel1, panel2). This is where I'm becoming stuck. Each panel is supposed to show a number of components with some of these components being on both. I've grouped these components together and added them to another panel (panel3). Form1 has a menu item which is used to choose panel1 or 2.
So I have something like
<br />
private: System::Void menuItem1_Click(System::Object * sender, System::EventArgs * e)<br />
{<br />
this->panel1->Visible = true;<br />
this->panel2->Visible = false;<br />
}<br />
to show the appropriate panel. Now what I also need to do is add panel3 to the visible panel. So I'm doing - or trying to do - something like
<br />
if ( this->panel1->Visible == true )<br />
{<br />
this->Controls->Add( this->panel3 );<br />
}<br />
But I can only get panel3 to show itself on one panel. Either panel1 or panel2 but never both.
|
|
|
|
|
I'd have thought the trick would be to move panel3 to be top in the z-order, so it is always visible above panel 1 OR 2, without adding it to either, just because it's part of the form.
Otherwise, do they have to be the same instance ? Perhaps you could create a control, add it to both panels, and then pass the data between the two so they look the same in terms of what is set on them ? Or do it using events ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
So basically have panel3 floating over the other panels. How do you change the z-order (sorry but new to all this)? And will this then lock the panel to its correct location throughout the forms lifespan?
|
|
|
|
|
In managed C++ - use SetWindowPos to set the Z order to top. The panel shouldn't move, unless you tell it to.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In MC++, use SetWindowPos with SWP_NOMOVE | SWP_NOSIZE and a position of TOP.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for the help Christian.
|
|
|
|
|
Also i have noticed that if i change select statment, there would not be any effect.
|
|
|
|
|
I would like to make a programme that list active users that are connected to my pc.
How do i get access to these information.
What should i look into?
|
|
|
|
|
I have a button in a dialog which when clicked opens an OpenFileDialog box and the user can select a file. The problem I am facing is that when I try and copy the file & path using the FileName function into a CString, I keep getting a NULL value.
The thing is, the code works as intended in the debug mode but doesnt in the release mode.
Below is the code I am using:
void CDisColEnvDlg::OnBnClickedButtonLocalBrowse()
{
// TODO: Add your control notification handler code here
System::Windows::Forms::OpenFileDialog* appOpenFileDialog = new System::Windows::Forms::OpenFileDialog();
appOpenFileDialog->Filter = S"Trace File (*.tf1)|*.tf1";
if (appOpenFileDialog->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
CString szFileName = appOpenFileDialog->FileName;
AfxMessageBox(szFileName,MB_OK|MB_ICONINFORMATION,0);
}
}
Can anyone tell me what the problem potentially could be.
Also, is there a way to do this using unmanaged code?
Thanks in advance.
--
If a program is useless, it must be documented.
|
|
|
|
|
vajjalu wrote:
Can anyone tell me what the problem potentially could be.
The string in the dialog is probably wide, try using _bstr_t.
vajjalu wrote:
Also, is there a way to do this using unmanaged code?
Yes, these dialogs exist in MFC, CFileDialog or COpenFileDialog or something. You can get at them without MFC as well, by filling a struct and passing it to an API function, I believe.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In your toolbox you have OpenFileDialog and SaveFileDialog. It's preaty easy to use it
|
|
|
|
|
Hi there!
I'm making an application using managed C++, and i'd like to know how
i could change the default appearance,with an easy way,(without using GDI+) of the form in something more presentable.(e.g adding some graphics). Is there any class that impements graphics or changes the resources of the form?
thanks in advance.
|
|
|
|
|
|
The Graphics class is the CDC equivelant in GDI+. If you don't want to use GDI+ in terms of drawing stuff yourself, you may as well avoid that altogether and just use picture box controls to put some images on your form.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello.
I have an element with attributes. Now i want to change attribute of an element. But i dont want to delete element and add. I would apritiace if there would be example.
Thanks.
|
|
|
|
|
If you have an XmlDocument, you can use SelectSingleNode with an XPath to get an XMLNode. This has an attributes collection, you can iterate through this and change the attribute you want.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks. I have serious slowdonw. About 2 Minutes. So i have chose to use Accsess Database through Jet. But i have decidet that i will use XML as Inport, Export and setting
|
|
|
|
|
Saksida Bojan wrote:
I have serious slowdonw. About 2 Minutes.
Where ?
Saksida Bojan wrote:
So i have chose to use Accsess Database through Jet.
What is slow that you think this will help ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
By using objects like critical sections and mutexes to syncronise access to common objects between threads.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
thanks for your reply.
Hi, i am from china.
|
|
|
|
|
I have written __gc class. now i don't know how to make Event Hande, declare it and ovverride
Can you help me, please
|
|
|
|
|
Hi all,
What's the best way for me to switch from one panel to the last visible panel. i.e. I have three panels on a form, panel2 (after some use) switches back to either panel1 or panel3 depending on which one was last being viewed. Does .net provide ant functions for this or will I have to write my own. If so what steps do I need to take.
Thanks
Rich
|
|
|
|