|
Hi Buck,
BuckBrown wrote: 'send to back'?
I don't know about that, I doubt it. The way I do it is:
- make sure your form is large enough (if necessary enlarge it temporarily), then:
- move the things that need to go into another, new, container, completely out of
the way, by selecting them all (drag a rectangle around them), then click one
of the controls and drag them all the way
- now insert the new Control (panel) and give it appropriate size
- now reselect the controls moved all out of the way, and drag them back, making
sure you release the mouse button while on top of the new Container (Panel).
- check: select one of the moved items (best is the top left inside panel),
look at its properties, it now should have small numbers for Location,
since this now is relative to panel if all went well.
- alternative check: watch the code generated by Designer, the checkboxes now
need to be added to the panel, not to the form.
Warning: it does not always succeed the first time, do one of the checks !
|
|
|
|
|
I still don't see how to access each control without specifying its name. Think about the GetNextControl(control_name) method. It's supposed to get the next control in the tab order but you still have to supply the explicit control name (at least thats the way I read the docs). I keep playing with the Control.ControlCollection to no avail. A link to any example would be appreciated.
Thanks
Buck
|
|
|
|
|
I can't quite wrap my head around this. If I have a panel that has multiple controls the documentation say I can access the controls using the panels' controls property. But I can't find any examples that show me how. How do I access each control without using the controls' name? It would seem that something like a 'for each' checkbox in the panel check the status of the checkbox, but there's something basic here I don't understand.
Buck
|
|
|
|
|
Hi Buck,
this is C# code that would do it, assuming myPanel contains only CheckBoxes:
foreach (CheckBox cb in myPanel.Controls) {
cb.Checked=false;
}
this is useful when myPanel contains also other types of Controls:
foreach (Control c in myPanel.Controls) {
CheckBox cb=c as CheckBox;
if (cb!=null) cb.Checked=false;
}
I don't speak C++ fluently, I trust you will be able to do the same in C++.
|
|
|
|
|
Hi Luc,
The C++/CLI syntax is...
for each(CheckBox^ cb in panelBin1->Controls)
cb->Checked::set(false);
I can see now that in order for this to work you need to declare a CheckBox^ place holder called cb that the 'for each' construct uses to copy each of the CheckBox controls into allowing access to that control. It was the declaration of this place holder that I had no idea about. I need to start thinking of types as more than just int, double, etc. Amazing that I could not find an example of this after an hour of googling.
Thanks a lot,
Buck
|
|
|
|
|
Hi Buck,
you're welcome.
The place holder pattern (if you want to call it that) is what is needed
by "for each"; it is rather similar to the input parameters in a method.
Some remarks:
1.
for each requires each element in the collection to be of the indicated type,
it does not act like a filter (that's why my second example needed the more
general Control type, followed by a more specific type check).
2.
you can use the place holder only as a read-only variable; you can't assign
a new value to it inside the for each loop.
3.
There are some surprising uses for foreach; example:
In C# you can do foreach(char c in myString); probably that works in C++ too.
4.
Sometimes you will prefer a regular for loop over for each, since that offers
an index, which may come in handy.
And one comment: if this is new to you, I suggest you get a book on managed C++,
and work your way through it. for each is one fundamental tool, if you're
unfamiliar with it, I trust there will be more you really should know.
Good luck with the CheckBoxes and everything!
|
|
|
|
|
i have used a text box in my dialog box in WIN32 programming....now i want that the data entered by user can be copied to a text file on pressing ok. what method can i use for this??
-- modified at 5:29 Thursday 2nd August, 2007
|
|
|
|
|
*sigh*
Again, you're still in the wrong forum. If you're writing Win32 code, you're making two horrible mistakes
1 - using Win32 code. Why would you ?
2 - asking in the C++/CLI forum, when you're using the oldest form of writing a dialog in C++ there is. This belongs in the Visual C++ forum.
GetWindowText is how you get the text out of a textbox.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, I am using Visual Studio C++/CLI. I am now playing around with the System::Drawing::Font class and I have seen Microsoft examples that use Dispose() but when I try to invoke the System::Drawing::Font::Dispose() function the compiler gives me an "error C2039: 'Dispose' : is not a member of 'System::Drawing::Font'". Does anyone know why this happens? The intellisense shows that the Dispose() method is a member of the Font class (as well as the Microsoft docs).
Thanks
Buck
|
|
|
|
|
Dispose() is a function inherited from the IDisposable interface. Its meant to implement the "Dispose pattern" to enable some form of immediate destructors in managed code. In C# you can call Dispose() on objects that will perform some clean up functions (like closing streams and such). In C++/CLI Dispose() is mapped to the class destructor by the compiler. You can't explicitly invoke Dispose() (nor write one). Instead, if an object encapsulating a resource needs some clean up done immediately (rather than waiting for the garbage collector) call either a Close() type function (which itself should only call the destructor I believe) or use delete (or declare the variable with stack semantics and have the destructor called automatically when the variable goes out of scope).
|
|
|
|
|
|
This bit me a bit when I recently migrated to VS 2005.
Here's an article that may help (even though the article is about porting to 2005, it contains relevant info about destructors and Dispose):
Changes in Destructor Semantics[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
|
please reply to my question atleast
|
|
|
|
|
What question? Forum rules say post your question and wait for an answer. Posting another message about it is considered rude.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
dona jain wrote: tell me the steps which should be followed to create a simple dialog box in Win32 programming using API.
Step 1: Post your question on the correct board. This is a good start since it puts your
question in the place where the correct persons that can help you will see it.
Step 2: Do a little research. Everything you need to know to create a working dialog is at the
core of Windows UI programming.
Windowing[^]
Dialog Boxes[^]
Step 3: If you run into a specific problem, return here and ask for help (on the correct message board, of course).
Bonus Step: Have a little respect for the people who give their time FOR FREE to help others on this site.
Try waiting a little longer than 1-2 hours for a reply. We are not all from India.
Good luck,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
dona jain wrote: please reply to my question atleast
poor kid
|
|
|
|
|
Hello friends,
I’m going to develop some application using C++, Linux platform. I need information about mathematics libraries which have following features –
1) Matrix manipulation –
a) It should support Matrix multiplication, Inverse, Transpose, etc functionality on large data set say 1 million rows and columns.
b) Finding Min or Max element by row or column.
2) Providing sort function which would sort matrix.
3) Algorithm used for sorting of matrix is most important because as per my knowledge Heap sort gives the best performance over larger dataset.
4) Any functionality to sort a data set which accepts a row / column from a matrix. i.e. Sorting function receives row / column of a matrix as parameter & returns sorted set of elements or sorted set of indices of that matrix.
Thnx & regards,
Shashikant
|
|
|
|
|
Shashi.Shinde wrote: Linux platform.
I'm guessing you're not using C++/CLI then. Try the Visual C++ forum.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Look for Numerical Recipies !
There you can find many algorithm, and the C function implementation.
Russell
|
|
|
|
|
Hi ,
Can anybody tell me how to Copy a WinForm from One project to another in VC++ 2005?
I tried including all files(.h, .resx, .cpp) but it gets included like source files. I dont get a designer view option for Form.h.
Any help/url is highly appreciated.
Thanks a lot!
art
|
|
|
|
|
tell me the steps which should be followed to create a simple dialog box in Win32 programming using API..i m trying to make a single and simple dialog window..please help me out...
-- modified at 8:57 Wednesday 1st August, 2007
|
|
|
|
|
Yesterday, you said C++ .NET, and I suggested that you needed to work out if you meant .NET, or if you wanted to use MFC or Win32. I also said C# is a better language than C++/CLI for Winforms ( forms with .NET ). So, now you're in the C++/CLI forum, and you're saying Win32. I'm sorry, but this question is in the wrong forum, yesterday you said .NET in the Visual C++ forum, and today you say 'Win32' in the C++/CLI forum. I recommend doing some reading to make sure you get your terminology right.
Programming Windows by Charles Petzold is THE book on Win32 programming, although I cannot imagine why anyone would want to use Win32 today. MFC is a far better option.
If you're using the C++ Express Edition, MFC is not an option, which may be why you're asking about Win32. Really, it's a bad idea. Learn C# instead, Win32 is too much like hard work, and Winforms is better supported in C#. You already found out how few people read this forum, compared to the other ones.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I would create a table who every cas was : array < String ^, 2 > ^ tab=gcnew array < String ^, 2 > (20, 200);
i try for array < String ^, 3 > ^ tab=gcnew array < String ^, 3 > (20, 200);, i can't make : tab[1][2]= subItems when array<string^>^ subItems=gcnew array<string^>(16);
Thank you verry mutch
|
|
|
|