|
Longhorn is the codename for the next generation of Windows, now called Windows Vista.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
i wld like to create any app whereby the user is free to press any buttons 1-10 simultaneously and the forms belonging to the respective buttons will be displayed.. eg. when u hit button 1, form 1 will be displayed.. when button 3 is hit, form 3 will display.. however, as my app should allow simultaneous displaying of forms, i cannot use modal forms.. with non-modal forms, too many forms will be displayed and it'll be irritating to look at the computer screen..
** i wld like to allow the user to display many non-modal forms n be able to select among the forms that are displayed, just like many windows can be displayed on the taskbar when i click on many types of icons on the desktop and allows the user to choose the window he wants to do his work..
** is it possible to know which buttons were pressed n allow the respective forms to be displayed in a 2nd form of tabpages? can tabpages be used to display information as if they are windows?
pls let me noe if u've better ideas to display many non-modal forms and in a neat manner instead of displaying so many pop-ups in the screen.. thanks..
many thanks for your answers/suggestions.. =)
|
|
|
|
|
nidhelp wrote:
pls let me noe if u've better ideas to display many non-modal forms and in a neat manner instead of displaying so many pop-ups in the screen.. thanks..
noe ? Goodness me.
A nom-modal form IS a popup, no two ways about it. Perhaps the only way to do it is to limit the number of forms visible at a time, or have your code that responds to the button presses move the forms so they are logically aligned with one another on the screen.
nidhelp wrote:
** is it possible to know which buttons were pressed n allow the respective forms to be displayed in a 2nd form of tabpages?
Absolutely - so you have a single modeless dialog and you add/remove tab pages as someone presses buttons ? Why not just have a form with the 10 tab pages ? You get the same result, except it's more logical to use.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
sorry but i don exactly get u.. do u mean i can display my forms in tabpages? do u mean the tabpage will automatically add/remove as n when the buttons are pressed/forms are closed by the user?
** i hope it is indeed possible for tabpages to be automatically enabled/disabled by effect of clicking more n more buttons/closing forms that are displayed.. i hope u get what im trying to explain..
by the way, im tryin to do this.. i've a main menu form for my app.. this form is divided into 2 parts.. the left side consists of tabpages with these 10 buttons.. the right side consists of tabpages where i want the forms to be displayed in when the user clicks on the buttons at the right of the form.. however, i do not know how/what to code to display the forms in the tabpage.. currently the forms are being displayed as pop-ups all across my screen when i click on the buttons.. how should i modify my codes?
any better idea is appreciated n i really thank u for your help! =)
|
|
|
|
|
nidhelp wrote:
sorry but i don exactly get u.. do u mean i can display my forms in tabpages? do u mean the tabpage will automatically add/remove as n when the buttons are pressed/forms are closed by the user?
Yeah, that's what you asked. You could create a dialog with a tab control on it, and expose methods to add/remove tab pages to call on button presses.
I don't believe you can turn a form into a tab page, I think you need to design them as tab pages to start with, on the control.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
can u go into more details like how do i create a tab control on the forms? ** i need some code examples to show me how to display a form in a tabpage.. any idea?
sorry im really new to c# n im still learning how the codes work for my app... sorry for the trouble.. thanks again =)
|
|
|
|
|
nidhelp wrote:
can u go into more details like how do i create a tab control on the forms?
You drag it onto a form in the designer.
Then you add tab pages to the control in the properties. You end up with member variables for the tab control and the pages. Something like this:
if (tabControl1.TabPages.Contains(tabPage1))
{
tabControl1.TabPages.Remove(tabPage1);
}
else
{
tabControl1.TabPages.Add(tabPage1);
}
will remove tabPag1 if it's there, or add it if it's not. You will not lose state in the pages through hiding/showing, but their order will change. So you add event handlers which you hook up to the buttons on the main page, and when you press a button, a tab page appears or disappears.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hmmmm.. so wat u've just typed is to allow tab page to appear or disappear depending on button press am i right? i hope i get wat u mean in your replies.. sorry if u r feeling frustrated wif all my questions..
** i still do not noe how to pop up a form IN a tab page.. can u teach me? i nid to research in books n online and ask people regarding my individual proj so i really appreciate your help.. thanks so much! =)
|
|
|
|
|
nidhelp wrote:
so wat u've just typed is to allow tab page to appear or disappear depending on button press am i righ
Yes, that's what I said, and what you asked. Did you try it ? I created a project, that code works for sure.
nidhelp wrote:
i still do not noe how to pop up a form IN a tab page..
If it can be done, it will be by creating the form and adding it to the tab pages controls collection. It's a hack though, you should set out the form on the tab page. I told you that already.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I want to modify control from one form to another already opened form. how can I do this?
thank you...
|
|
|
|
|
Within the same app ? Modify how ? What do you want exactly ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In the same app, and modify a property of a control. for example: modify the tag property of a listbox.
|
|
|
|
|
Expose a property that does what you want, and call it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
This is what I couldn't do.
I made form1.listbox1 as public, then I tried to use from form2: form1.listbox1
but i don't have .listbox1 in the list of form1. how can I do this?
|
|
|
|
|
Anonymous wrote:
I made form1.listbox1 as public
Don't - that's terrible design.
Anonymous wrote:
then I tried to use from form2: form1.listbox1
So form1 is the variable that holds an instance of the form1 in question ? It's a floating dialog ?
Anonymous wrote:
how can I do this?
I'd say the problem is that you're typing in the class name, which won't work, you'll only see static methods there. You need to have an instance of the form in order to change it's properties. Which means you should have a member variable for a dialog you're about to show, or a modeless dialog. Then you can set properties on it, but properties of controls will only work if the form has been created and is visible. Otherwise, they need to be stored and acted on in the event handling cycle of the form being created and shown.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
its a terrible design, but I'm working on sombody else code, and its the fastest way.
form2 is a floating dialog. form1 is already open. I don't know how can I have an instance of the form, I know only how to have a new instance of form:
someform varForm = new someform();
|
|
|
|
|
Anonymous wrote:
its a terrible design, but I'm working on sombody else code, and its the fastest way.
Bad design is ALWAYS the fastest way, why else would anyone write crap code ?
So you want to change something in form1, from form2 ? From what you said you tried, you're obviously lost at sea. A form is a class, and you can have multiple instances of that class. To change something in an instance, you need to have that instance, or a reference to it. Seeing as you're looking for quick and ugly, you can make Form2's constructor take an instance of Form1, and pass in this when you create form2. Then you need to store that variable in Form2 and you can set it's properties.
OR, if you want to spend 30 seconds doing it properly, define a delegate in Form2, and when you create it, set the delegate to call a function in Form1. Then Form2 can notify Form1 of events in a nice, OO manner.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
"you can make Form2's constructor take an instance of Form1"
I didn't succeed in doing this )-: do you have an example, maybe?
|
|
|
|
|
This is not an insult - abandon this project now. You should not be working on someone elses code, you should be reading a couple of basic programming books.
Having said that,
private Form1 form1;
public Form2(Form1 theForm)
{
form1 = theForm;
}
// Hide the default constructor.
private Form2(){}
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a lot of experience with software programming, but not at all with this language. but I can't abandon it. )-':
anyway, thank you very much for your helping!
|
|
|
|
|
Anonymous wrote:
I have a lot of experience with software programming, but not at all with this language. but I can't abandon it. )-':
Fair enough. I'd have expected the languages you could know without knowing how to modify a constructor would be limited. Either way, do it properly, or pay the price later.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Can somebody make the regex expression described below for me?
Consider the following "main" string...
Day,Amount,Direction;3,100,West;5,43,North;5,44,North West;7,54,South;2,5995,East;,,;,,;,,;54,35345,;,543,North;6,,West
Can you make an expression that will match each groupe of 3 items inbetween the semicolons? Example matches would be..
Day,Amount,Direction<br />
3,100,West<br />
5,43,North<br />
5,44,North West (Make sure you preserve the space)<br />
7,54,South<br />
2,5995,East<br />
,,<br />
,,<br />
,,<br />
54,35345,<br />
,543,North<br />
6,,West
The expression should be along the lines of this: (.*?),(.*?),(.*?)(?=; ) , that's all I could come up with. In engish I want the regex to do this:
Match any number of words, including nothing(seperated by a comma)Match any number of words, including nothing(seperated by a comma)Match any number of words, including nothing(ended with a semi-colon, but don't include in the match)
The main premise here is the "including nothing".
So If I run the expression "5,," against the "main" string above it should return 2 matches:
5,43,North<br />
5,44,North West (preserve white space)
It would return those because the expression would match the words in the expresion and if it's blank it would match anything.
Another example, if I ran ",Day," against the "main" string it would return 1 result:
Day,Ammount,West , if I ran "3,100,West" it would return 1 match, etc.
It would really help if somebody could figure out an expression to match something like this. If you have any questions just ask.
Thanks.
/\ |_ E X E GG
|
|
|
|
|
I thought I did this already :
([^,]*,[^,]*,[^,]*);
this will match all but the ;, you can put a ? next to the ; to make it optional,
([^,]*,[^,]*,[^,]*);?
If you replace [^,]* with Day, for example, then you get the match you're looking for. ( you get a search as well ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I didn't know it would work again in this way. One thing though... Is there a way to exclude the ";" from the matches? The question mark didn't work. I'm running it on this string...
/\ |_ E X E GG
|
|
|
|
|