[Gambas-user] Help in new UserControl's Click event

Safiur Rahman isafiur at gmail.com
Sat Oct 21 16:40:07 CEST 2023


Thank you all for your help.

On Sat, Oct 21, 2023 at 5:36 PM Safiur Rahman <isafiur at gmail.com> wrote:

> Hi
>
> Can you provide the updated code which works.
>
> On Sat, Oct 21, 2023 at 3:41 PM Safiur Rahman <isafiur at gmail.com> wrote:
>
>> 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
>>
>
>
> --
> Regards
> Safiur Rahman
>


-- 
Regards
Safiur Rahman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231021/ab013459/attachment.htm>


More information about the User mailing list