Add an optional alt text tag to ButtonImageGadget

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Ty1003
User
User
Posts: 31
Joined: Thu May 14, 2020 10:31 pm

Add an optional alt text tag to ButtonImageGadget

Post by Ty1003 »

Hello,
ButtonImageGadgets are not currently accessible to screen readers, as would be expected, as they simply have images, which screen readers can't read.
It would be great if an optional parameter could be added to them, Text, similar to ButtonGadget's text, so I could tell what the buttons were, if the developer provided a Text tag.
Example:
ButtonImageGadget(0,10,30,100,120,#MyImage,"OK")
I'm not sure how visually pleasing this would look, or if the buttons is even an okay size, as I am blind, but it would be great to see!
Little John
Addict
Addict
Posts: 4527
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Add an optional alt text tag to ButtonImageGadget

Post by Little John »

Help for GadgetToolTip() wrote:Syntax

GadgetToolTip(#Gadget, Text$)

Description

Associate the specified Text$ with the #Gadget.
Did you try adding text to a ButtonImageGadget with GadgetToolTip()?
Can the sreen reader read that text properly?
Ty1003
User
User
Posts: 31
Joined: Thu May 14, 2020 10:31 pm

Re: Add an optional alt text tag to ButtonImageGadget

Post by Ty1003 »

Hi.
From what I've seen, gadget tooltips can read, if the setting is turned on. So this does work, however, I doubt many people will put one... :(
nsstudios
Enthusiast
Enthusiast
Posts: 274
Joined: Wed Aug 28, 2019 1:01 pm
Location: Serbia
Contact:

Re: Add an optional alt text tag to ButtonImageGadget

Post by nsstudios »

+1
This is especially important because of ide, where certain things like profiler use image buttons and all you hear is "button", "button", "button", and have no idea what's what.
Tested GadgetTooltip with two screen readers that are used the most, and neither of them reads tooltips, and even if they did, this should not be relied upon, because many people disable reading of the same because of the often needless extra verbosity.

Code: Select all

OpenWindow(0, 0, 0, 500, 500, "test", #PB_Window_ScreenCentered|#PB_Window_Maximize)
CreateImage(0, 32, 32)
ButtonImageGadget(0, 0, 0, 32, 32, ImageID(0))
GadgetToolTip(0, "test123")

Repeat: Until WaitWindowEvent()=#PB_Event_CloseWindow
Little John
Addict
Addict
Posts: 4527
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Add an optional alt text tag to ButtonImageGadget

Post by Little John »

nsstudios wrote:This is especially important because of ide, where certain things like profiler use image buttons and all you hear is "button", "button", "button", and have no idea what's what.
Uuhm ... that sounds crazy.
nsstudios wrote:Tested GadgetTooltip with two screen readers that are used the most, and neither of them reads tooltips, and even if they did, this should not be relied upon, because many people disable reading of the same because of the often needless extra verbosity.
Good to know. Thanks for the information.
User avatar
DoubleDutch
Addict
Addict
Posts: 3219
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: Add an optional alt text tag to ButtonImageGadget

Post by DoubleDutch »

Is there a mechanism in Windows to actually do this though (apart from tootips)?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
nsstudios
Enthusiast
Enthusiast
Posts: 274
Joined: Wed Aug 28, 2019 1:01 pm
Location: Serbia
Contact:

Re: Add an optional alt text tag to ButtonImageGadget

Post by nsstudios »

I'm not really sure, but doing a quick Google search on button with both an image and text yealds:
The appearance of text or an icon or both on a button control depends on the BS_ICON and BS_BITMAP styles, and whether the
BM_SETIMAGE
message is sent. The possible results are as follows.

BS_ICON or BS_BITMAP set? | BM_SETIMAGE called? | Result
--------------------------+---------------------+--------------------
Yes | Yes | Show icon only.
No | Yes | Show icon and text.
Yes | No | Show text only.
No | No | Show text only

In other words: Don't set the BS_ICON or BS_BITMAP style (but do set the BS_TEXT style), and send a BM_SETIMAGE message once the button has been created.
https://stackoverflow.com/questions/479 ... ext-button
Post Reply