[Gambas-user] Modifying a picture assigned to a menu
David Dell
davidmdell at ...626...
Sat Nov 28 09:13:42 CET 2009
> Because the underlying toolkit uses its own "picture" object that is not
> automatically reassigned to the control automatically. In other words, assume
> that the Picture property returns a copy of the underlying picture.
I hope this doesn't create extra unneeded picture objects in memory,
so I can perform code like:
DIM Pic AS Picture
Pic = MenuCustomColor.Picture
Pic.Fill(Dialog.Color)
MenuCustomColor.Picture = Pic
for any number of times without memory penalties.
Please confirm this.
Thank you,
David
On Sat, Nov 28, 2009 at 10:09 AM, David Dell <davidmdell at ...626...> wrote:
>> Let's say first I assign a picture to a menu:
>>
>> DIM Pic AS Picture
>> Pic = NEW Picture(18, 18)
>> Pic.Fill(Color.Black)
>> MenuCustomColor.Picture = Pic
>>
>> When I try to modify a picture assigned to a menu, if I use
>>
>> MenuCustomColor.Picture.Fill(Dialog.Color)
>>
>> it does not do anything.
>>
>> Instead I have to do:
>>
>> DIM Pic AS Picture
>> Pic = MenuCustomColor.Picture
>> Pic.Fill(Dialog.Color)
>> MenuCustomColor.Picture = Pic
>>
>> Why is that?
>
> Because the underlying toolkit uses its own "picture" object that is not
> automatically reassigned to the control automatically. In other words, assume
> that the Picture property returns a copy of the underlying picture.
>
> I did a workaround only for the Control.Font property. I mean, settings
> Control.Font.Bold for example automatically reassigns the control font so that
> you see the change.
>
>>
>> And is this the correct way to do this?
>
> So, yes!
>
> Regards,
>
> --
> Beno?t Minisini
>
More information about the User
mailing list