[Gambas-user] Delete button ?

dirk yodi at gmx.net
Tue Jan 3 17:15:53 CET 2023



Am 03.01.23 um 16:02 schrieb gian via User:
> Il 03/01/23 15:56, gian via User ha scritto:
>> Il 03/01/23 15:40, gian via User ha scritto:
>>> Il 03/01/23 15:16, dirk ha scritto:
>>>>
>>>>
>>>> Am 03.01.23 um 14:24 schrieb T Lee Davidson:
>>>>> On 1/3/23 07:48, dirk wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> I create a button like this in the form 'lager':
>>>>>>
>>>>>> ' Gambas class file
>>>>>> ' lager.class
>>>>>> '
>>>>>> Public Sub Form_Open()
>>>>>>
>>>>>>   With ButtonSave = New Button(FMain.Panel1) As "ButtonP"
>>>>>>        .H = 28
>>>>>>        .W = 28
>>>>>>        .X = 959 - 35
>>>>>>        .Y = 5
>>>>>>        .Expand = False
>>>>>>        .Picture = Picture["icon:/32/print"]
>>>>>>
>>>>>>      End With
>>>>>> End
>>>>>>
>>>>>> If I make another form visible in workspace1, the button should
>>>>>> disappear.
>>>>>>
>>>>>> the button should only be visible if the form is 'lager' visible.
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Dirk
>>>>>
>>>>> It is difficult to tell exactly what you're trying to accomplish
>>>>> without
>>>>> knowing what forms you have in your project. But, "New
>>>>> Button(FMain.Panel1)" creates a button with FMain.Panel1 as its
>>>>> parent -
>>>>> thereby placing it on the FMain form.
>>>>>
>>>>> Gianluigi's example is a good illustration.
>>>>>
>>>>>
>>>> Hello,
>>>>
>>>> I don't know how to describe it.
>>>> I took two pictures, I hope it is understandable what I want.
>>>>
>>>> Greetings Dirk
>>>>
>>>>
>>>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>>
>>> You can put the button as public although it is a practice I do not
>>> recommend.
>>> If you look at Benoit's code (the IDE uses workspace) he uses button
>>> bars inside the window which is a better practice.
>>>
>>> Example attached
>>>
>>> Regards
>>>
>>> Gianluigi
>>>
>>>
>>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>> I recommend it like this (see attached)
>>
>> Regards
>>
>> Gianluigi
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
> With the copy and paste I forgot the Public button, it should be put as
> private (Public = False)
>
> Regards
>
> Gianluigi
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Hello,

Thanks for your help. It inspired me ;)
i do it like this now

Public Sub Workspace1_Activate()

If Workspace1.ActiveWindow.Name <> "lager" Then
    ButtonLagerP.Visible = False
  Else
    ButtonLagerP.Visible = True
Endif

End

Public Sub ButtonLagerP_Click()

    If lager.ColumnView1.Key Then
       TextArea1.Visible = True
       button18.Visible = True
       button19.Visible = True
       TextArea1.Text = lager.ColumnView1[lager.Columnview1.Key][1] & "\n"
      If lager.ColumnView1[lager.Columnview1.Key][6] Then
         TextArea1.Text &= "Min.Best." &
lager.ColumnView1[lager.Columnview1.Key][6] & "   Max.Best." &
lager.ColumnView1[lager.Columnview1.Key][4]
      Endif

    Endif
End

regards dirk



More information about the User mailing list