How should icons be used in LDControls.AddMenu() - Printable Version +- Small Basic Forum (https://litdev.uk/mybb) +-- Forum: Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=1) +--- Forum: Extensions (https://litdev.uk/mybb/forumdisplay.php?fid=3) +--- Thread: How should icons be used in LDControls.AddMenu() (/showthread.php?tid=25) |
How should icons be used in LDControls.AddMenu() - Scout - 12-12-2023 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) RE: How should icons be used in LDControls.AddMenu() - jrmrhrb00 - 12-13-2023 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") RE: How should icons be used in LDControls.AddMenu() - Scout - 12-13-2023 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") RE: How should icons be used in LDControls.AddMenu() - jrmrhrb00 - 12-13-2023 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 RE: How should icons be used in LDControls.AddMenu() - litdev - 12-14-2023 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/3842493/wpf-menuitem-with-image-and-ischeckable-set |