B4J Question Mainform.Icon

amykonio

Active Member
Licensed User
Longtime User
Hi.
I put an icon in files.
Then create a button where I put the following code:
B4X:
MainForm.Icon = fx.LoadImage(File.DirAssets, "x.png")

Also, I've tested and it works if instead of file.dirassets I use a path...
B4X:
    MainForm.Icon = fx.LoadImage("/Develop/B4J/LoansCollection/Files", "DataEntry.png")

Andreas.
 
Upvote 0

BeneBarros

Active Member
Licensed User
Longtime User
Hi.
I put an icon in files.
Then create a button where I put the following code:
B4X:
MainForm.Icon = fx.LoadImage(File.DirAssets, "x.png")

Also, I've tested and it works if instead of file.dirassets I use a path...
B4X:
    MainForm.Icon = fx.LoadImage("/Develop/B4J/LoansCollection/Files", "DataEntry.png")

Andreas.
thanks, but i need to change the icon at runtime.
This function does not change the icon on the taskbar.
 
Upvote 0

BeneBarros

Active Member
Licensed User
Longtime User
It does change the task bar icon. Tested with this code:
B4X:
'BitmapCreator and XUI
Dim bc As BitmapCreator
bc.Initialize(32, 32)
For i = 1 To 100
   bc.DrawRect(bc.TargetRect, Rnd(0xff000000, -1), True, 0)
   MainForm.Icon = bc.Bitmap
   Sleep(1000)
Next
Thank you ,,, it works perfectly.
 
Upvote 0
Top