On Tue, 18 Nov 2014, Martin McGlensey wrote:
> Hello,
> 
>  
> 
> I have created a dialog form. As created by Gambas, it has an OK and Cancel
> button. I want to return three properties or an array from the form. One
> each for the three textboxes on the form.
> 
> I added a textbox to the form to test it. Call it Textbox1. Used the code
> below to add a property called "Login" to the Dialog:
> 
>  
> 
> Property Login As String
> 
> Private strLogin AS String
> 
>  
> 
> Private Function Login_Read()
> 
>                 Return txtTextbox1.Text
> 
> Return
> 
>  
> 
> Private Sub Login_Write(Value as String) as String
> 
>                 strLogin = Value
> 
> End
> 
>  
> 
> I call the Dialog from the main form by frmDialog.ShowModal. When I load the
> frmDialog, enter the text in the textbox and click OK. The Dialog closes but
> no value is returned to the main form.
> 
> If I explicitly set Login_Read to Return "XYZ" it works  properly. It
> returns "XYZ" to the main form. If I try to get the contents of
> Textbox1.Text it returns an empty string. There has got to be a way of
> returning the value of a textbox as a property of a dialog form.  I'd rather
> not use public variables on the main form as there are too many variables
> already.
> 
> Would you guys please point me in the right direction.
> 

This is a standard task and therefore a "template solution" evolved in the
Gambas sources. Attached is a project which shows how to do it cleanly, no
public variables and no auxiliary classes needed.

If you have a problem with the project and comments being German, I will
translate it for you...

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

Attachment: login-form-0.0.2.tar.gz
Description: Binary data

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to