[Gambas-user] Help in new UserControl's Click event
Fabien Bodard
gambas.fr at gmail.com
Sat Oct 21 12:34:08 CEST 2023
Just change
Public $Value as string
by
Private $Value as String
and you will understand your error ;-)
Le sam. 21 oct. 2023 à 11:57, Safiur Rahman <isafiur at gmail.com> a écrit :
> Hello
>
> I am trying to learn how to create a simple user control in gambas. The
> new control consists of two RadioButtons arranged Horizontally. When I
> click any of the two RadioButton the radioButton's Text becomes the new
> control's value and also any of the radiobutton's click event becomes the
> new control's click event.
>
> However, on clicking radio button doesn't fire the new control's click
> event
> I am creating new UserControl called "TwoRadio"
>
> ''----------- TwoRadio ---------------------------
> Export
> Inherits UserControl
>
> Public Const _Properties As String = "*,Value"
> Property Value As String
> Event Click
>
> Private $hForm As FmTwoRadio
> Public $Value As String
>
> Public Sub _new()
> $hForm = New FmTwoRadio(Me)
> End
>
> Private Function Value_Read() As String
> Return $Value
> End
>
> Private Sub Value_Write(Value As String)
> $Value = Value
> Raise Click
> End
>
> ''------------------- fmTwoRadio -------------------
> Private Sub GetParent() As TwoRadio
> Return Me.Parent
> End
>
> Public Sub rboptfir_Click()
> GetParent().$Value = rboptfir.Text
> End
>
> Public Sub rboptsec_Click()
> GetParent().$Value = rboptsec.Text
> End
> ''-------------- complete ---------------------
>
> Now when I put the new user control "TwoRadio1" and a TextBox "TextBox1"
> in FMain form:
>
> Public Sub TwoRadio1_Click()
> TextBox1.Text = TwoRadio1.Value
> End
>
> This does not show radiobutton's text in the textbox. Attached a project
>
> --
> Regards
> Safiur Rahman
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
--
Fabien Bodard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231021/d4e06b1d/attachment.htm>
More information about the User
mailing list