We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How should icons be used in LDControls.AddMenu()
#1
The following program overwrites the line checklist["By Index"]="True" the On.ico icon.
How should the icons be used?

menuList["File"] = "Main"
menuList["Record"] = "Main"
menuList["Sort"] = "Main"
menuList["Help"] = "Main"
menuList["New Database"] = "File"
menuList["Open Database"] = "File"
menuList["Exit"] = "File"
menuList["Add Record"] = "Record"
menuList["Find by ID"] = "Record"
menuList["Records"] = "Record"
menuList["Exact Match"] = "Records"
menuList["Partial Match"] = "Records"
menuList["By Field"] = "Sort"
menuList["By Index"] = "Sort"
menuList["Print File"]= "Sort"
menuList["Print Label"]="Sort"
menuList["About"] = "Help"
iconList["File"]= Program.Directory + "\On.ico"
iconList["New Database"]= Program.Directory + "\On.ico"
iconList["Records"] = Program.Directory + "\On.Ico"
iconList["Exact Match"] = Program.Directory + "\On.Ico"
iconList["Partial Match"] = Program.Directory + "\Off.Ico"
iconList["By Index"] = Program.Directory + "\On.Ico"
iconList["By Field"] = Program.Directory + "\Off.Ico"
iconList["About"] = Program.Directory + "\On.Ico"
checklist["By Index"]="True"
menu = LDControls.AddMenu(GraphicsWindow.Width,32,menuList,iconList,checkList)
Reply
#2
Scout,

On the program below if you place your icon in c:\temp\database.jpg this should work for you. I attached a file with my database icon. All it does is put a little icon at the top left corner of the graphics window.

JR


menuList["File"] = "Main"
menuList["Open"] = "File"
menuList["-"] = "File"
menuList["Exit"] = "File"
menuList["Help"] = "Main"
menuList["Show Help"] = "Help"
iconList["File"]="c:\temp\database.jpg"
checkList["Show Help"] = "True"
menu = LDControls.AddMenu(GraphicsWindow.Width,20,menuList,iconList,checklist)
LDShapes.BrushColour(menu,LDColours.AliceBlue)
LDShapes.PenColour(menu,"Black")


Attached Files Thumbnail(s)
   
Reply
#3
JR,
I also linked the database icon to the main menu "Help" and "Show Help".
I see the following differences in "Show Help" compared to the main menu line.
The icon is displayed larger and can be displayed or suppressed via Checklist.
Apparently the icon collides with the checklist checkmark here.
I can think of two uses of icons in menus:
1.) The complete entry is displayed as a bitmap like in mystical games.
2.) The icon is assigned to the text as additional information like in selection lists in Word.
I assume that the second variant should be implemented here, but a separate space should then be reserved for the checklist tick.

Scout

menuList["File"] = "Main"
menuList["Open"] = "File"
menuList["-"] = "File"
menuList["Exit"] = "File"
menuList["Help"] = "Main"
menuList["Show Help"] = "Help"
iconList["File"]= Program.Directory + "\database.jpg"
iconList["Help"]= Program.Directory + "\database.jpg"
iconList["Show Help"]= Program.Directory + "\database.jpg"
checkList["Show Help"] = "True"
'checkList["Show Help"] = "False"
menu = LDControls.AddMenu(GraphicsWindow.Width,20,menuList,iconList,checklist)
LDShapes.BrushColour(menu,LDColours.AliceBlue)
LDShapes.PenColour(menu,"Black")
Reply
#4
Scout,

Truthfully, I only put the icon there because I thought it looked neat. I really don't understand the reason for the checkmarks and multiple icons. Maybe LitDev has a good explanation. He generally does.

JR
Reply
#5
Hi Scout/JR,

The icon is purely there to make thinks prettier or maybe help as quick visual guide to options, and the check is for items that can have a simple on/off toggle option.

You are right that the icon and check seem to be mixed up in some way, probably best to not use both for any specific item.  I checked my code and don't think I do anything obviously causing this and a bit of googling seems to suggest this is actually expected default behaviour? for example:

https://stackoverflow.com/questions/3842...ckable-set
[-] The following 1 user Likes litdev's post:
  • Scout
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)