Re: [Gambas-user] Really dumb question about dialog forms
Kadaitcha Man ha scritto: If I create a new form with the dialog support it gets this code: Public Sub Run() As Boolean If I had a textbox on the form and wanted to return its contents, what would be the change in syntax required? None whatsoever. Create a public variable in a common module. Set the variable from within your modal form and read it from somewhere else, such as the code that called the form, for example. ...with good restful peace for good programming tecniques... I don't know what is this issue of modal forms support in gambas3 but, if things are as you have put them, then it is awful. Anyway, to create variables in yet another module, so ones have three files to do a single thing, is just the best way to mess up everything. Regards, Doriano -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Really dumb question about dialog forms
2009/12/11 Doriano Blengino doriano.bleng...@fastwebnet.it: Kadaitcha Man ha scritto: If I create a new form with the dialog support it gets this code: Public Sub Run() As Boolean If I had a textbox on the form and wanted to return its contents, what would be the change in syntax required? None whatsoever. Create a public variable in a common module. Set the variable from within your modal form and read it from somewhere else, such as the code that called the form, for example. ...with good restful peace for good programming tecniques... I don't know what is this issue of modal forms support in gambas3 but, if things are as you have put them, then it is awful. Anyway, to create variables in yet another module, so ones have three files to do a single thing, is just the best way to mess up everything. First up, one generally does not write a GUI application to do one single thing so creating a public variable in some module should not be a major issue. Second, someone else will have to tell you if there is a method other than what I describe; I looked for days and found nothing. I tried for many hours and failed to get it to work. When the Close() method is called by the modal window, the window instantly commits Harakiri and invalidates itself, so even if you instantiate a form inside a form variable, the window is instantly dereferenced the moment Close() executes. Gambas should not do that, IMO. The form should stay accessible to programmer via the variable until the programmer destroys it, or until the method that created the form variable terminates. I know it isn't kosher OO behavior, but what do you want from Gambas? Is having kosher OO more important than being able to choose not to have to learn C++, Pascal, or Java? -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Really dumb question about dialog forms
if you do not calm kadaitcha man you gonna get fired from this mailing list. I have not used it but you are insulting and it is not necessary. I would simply point out to you that all your intervention are not necessarily very bright Also if this is not to answer the question ... It is wiser to shut up! To Richard: Static Public sValue as string Public Sub Run () As Boolean Return Not Me.ShowModal () End Public Sub btnOK_Click () sValue = TextBox1.Text Me.Close (True) End Public Sub btnCancel_Click () Me.Close End MyForm.Run if () then Print MyForm.sValue endif In this case sValue is static and can be called as if the class was a module. This is useful in this case among others. But for example if you were more instances of the same class (not in modal mode), and that each instance fesait Appeal sValue ... then you might not know the result ... sValue is common to all instances. As if MyClass was a separate module. That's all and not really a stupid question. Fabien Bodard -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Really dumb question about dialog forms
if not MyForm.Run() then Print MyForm.sValue endif 2009/12/11 Fabien Bodard gambas...@gmail.com: if you do not calm kadaitcha man you gonna get fired from this mailing list. I have not used it but you are insulting and it is not necessary. I would simply point out to you that all your intervention are not necessarily very bright Also if this is not to answer the question ... It is wiser to shut up! To Richard: Static Public sValue as string Public Sub Run () As Boolean Return Not Me.ShowModal () End Public Sub btnOK_Click () sValue = TextBox1.Text Me.Close (True) End Public Sub btnCancel_Click () Me.Close End MyForm.Run if () then Print MyForm.sValue endif In this case sValue is static and can be called as if the class was a module. This is useful in this case among others. But for example if you were more instances of the same class (not in modal mode), and that each instance fesait Appeal sValue ... then you might not know the result ... sValue is common to all instances. As if MyClass was a separate module. That's all and not really a stupid question. Fabien Bodard -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Really dumb question about dialog forms
richard terry wrote: On Friday 11 December 2009 17:22:54 you wrote: 2009/12/11 richard terry rte...@pacific.net.au: Hi List, My really stupid question for the week. I'm sorry. You've already done that three times this week. If I had a textbox on the form and wanted to return its contents, what would be the change in syntax required? None whatsoever. Create a public variable in a common module. Set the variable from within your modal form and read it from somewhere else, such as the code that called the form, for example. Thanks in anticipation. I'll send you the bill. I've already done that and its the method I use, so no $ accrue to you, however I wondered if there was way of returning it via the modal form. Forgive my stupidity, but I must be missing something here. I don't understand the problem. My understanding is that when form controls are set public, you just access the contents of any form from the form you are in. Modal or not. Or have I been doing it wrong? Sorry, I get it now. No export from Dialog. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Really dumb question about dialog forms
2009/12/11 Fabien Bodard gambas...@gmail.com: Also if this is not to answer the question ... It is an answer to the question. It is wiser to shut up! if you do not calm kadaitcha man you gonna get fired from this mailing list. I have not used it but you are insulting and it is not necessary. I would simply point out to you that all your intervention are not necessarily very bright You can go and fuck yourself violently up the arse with the sharp end of a broken champagne bottle for all I care. Mes couilles sur ton nez. I guess this means goodbye, hey? Parting is such sweet sorrow. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Really dumb question about dialog forms
richard terry wrote: On Friday 11 December 2009 17:22:54 you wrote: 2009/12/11 richard terry rte...@pacific.net.au: Hi List, My really stupid question for the week. I'm sorry. You've already done that three times this week. If I had a textbox on the form and wanted to return its contents, what would be the change in syntax required? None whatsoever. Create a public variable in a common module. Set the variable from within your modal form and read it from somewhere else, such as the code that called the form, for example. Thanks in anticipation. I'll send you the bill. I've already done that and its the method I use, so no $ accrue to you, however I wondered if there was way of returning it via the modal form. Forgive my stupidity, but I must be missing something here. I don't understand the problem. My understanding is that when form controls are set public, you just access the contents of any form from the form you are in. Modal or not. Or have I been doing it wrong? -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Really dumb question about dialog forms
2009/12/12 Kadaitcha Man nospam.nospam.nos...@gmail.com: 2009/12/11 Fabien Bodard gambas...@gmail.com: Static Public sValue as string Public Sub Run () As Boolean I knew there was a reason not to use your method and to make the recommendation I did. If you tested that code then I presume you did it in gb3 and not gb2. Gambas 2 either crashes out with a SIG 11, or in some unfathomable instances, when the form is closed, it drops into debug and complains about the pending destruction of a public static variable. Furthermore if the form is instantiated in a variable of type Form then you cannot access the public static by referencing the variable as a property in the instanced form type variable; the only way to get to the value of the public static is directly from the class itself, like this: DIM ff AS NEW Form1 IF NOT ff.Run() THEN PRINT Form1.sValue ENDIF In short, Fabien, as far as I can tell, the only way to make it work correctly in gb2 is to do it the way I originally said to do it. Of course I'm open to being shown to be wrong. in fact you are right in the vb way ... but not it OO way... And gambas is more in the OO one and since the begining. For the return problem ... there is not problem as the run procedure can return the value. You can use a public variable in a module too Private sValue as string STATIC Publc Run() as string if not me.showmodal then return return sValue END dim s as string s = fForm.Run if s then print s -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Really dumb question about dialog forms
2009/12/12 Fabien Bodard gambas...@gmail.com: 2009/12/12 Kadaitcha Man nospam.nospam.nos...@gmail.com: In short, Fabien, as far as I can tell, the only way to make it work correctly in gb2 is to do it the way I originally said to do it. Of course I'm open to being shown to be wrong. in fact you are right in the vb way ... but not it OO way... It looks broken to me, but that's just my opinion. You can use a public variable in a module too That was essentially what I indicated he should do. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Really dumb question about dialog forms
On Friday 11 December 2009 17:22:54 you wrote: 2009/12/11 richard terry rte...@pacific.net.au: Hi List, My really stupid question for the week. I'm sorry. You've already done that three times this week. If I had a textbox on the form and wanted to return its contents, what would be the change in syntax required? None whatsoever. Create a public variable in a common module. Set the variable from within your modal form and read it from somewhere else, such as the code that called the form, for example. Thanks in anticipation. I'll send you the bill. I've already done that and its the method I use, so no $ accrue to you, however I wondered if there was way of returning it via the modal form. BTW when replying on the list its useful ***not to snip out the guts of the question*** so that others reading your reply can make sense of it. Regards Richard -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Really dumb question about dialog forms
2009/12/11 richard terry rte...@pacific.net.au: BTW when replying on the list its useful ***not to snip out the guts of the question*** so that others reading your reply can make sense of it. Why put the onus on me for something that annoys only you? If you don't like the way I reply, don't read them. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user