soccer jersey forums.silverfrost.com :: View topic - A proble with an accelerator key using ampersand (&)
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A proble with an accelerator key using ampersand (&)

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Martin_K



Joined: 09 Apr 2020
Posts: 227

PostPosted: Fri May 08, 2020 4:13 pm    Post subject: A proble with an accelerator key using ampersand (&) Reply with quote

Hello guys,

Has anybody observed the following (from my point of view) non-standard behavior when using ampersand (&) to define an accelerator key? (I have the FTN95 version 8.61 and Plato 5.2.0)

Here is the description of the situation:

In my code, I often use the ampersand (&) mark to let underline the unique letters in menu/submenu/buttons for using with the ALT key.

But, when I start the program, initially - I see NO underlined letters in menu (and submenu - if available) items. They (the underlined letters) are ONLY then visible, when I physically press the ALT key on the keyboard first (then they appear and function as expected).

However, as soon as I click with my mouse either in the main window area of the program or also outside of this area, the underlined letters become again non-underlined, so I have to press again the ALT key on the keyboard to see them underlined again (which then again disappear by any next mouse clicking) and so on around.

This does NOT apply to buttons. There (when used) - the underlined characters are always visible without the need to press the ALT key first!

REMARK: I use the function CALL ENABLE_UTF8@(1) to be able to use non-ASCII characters (in my case - such non-ASCII characters which are part of the slovak alphabet).

Martin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7931
Location: Salford, UK

PostPosted: Fri May 08, 2020 6:21 pm    Post subject: Reply with quote

This could also be because you are using UTF-8 encoding. If you will post a short sample program then I will aim to fix the problem.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2390
Location: Yateley, Hants, UK

PostPosted: Fri May 08, 2020 6:54 pm    Post subject: Reply with quote

Isn't that the normal behaviour in Windows 10?

Eddie
Back to top
View user's profile Send private message
Martin_K



Joined: 09 Apr 2020
Posts: 227

PostPosted: Fri May 08, 2020 7:28 pm    Post subject: Reply with quote

Paul,

here an excerpt of the program, which creates the menu items:

Code:


ans=winio@('%mn[&S�bor[&Otvoriť s�bor,~Zme&niť znamienka pre DX a DY]]&',cb_open_in_out,button_grey_control,cb_znam)
ans=winio@('%mn[[~Začať &konverziu,|,&Ukončiť]]&',button_grey_control,cont,knc)
ans=winio@('%mn[&Mapa[~&Zobraziť]]&',button_grey_control_mapa,knc)
ans=winio@('%mn[Po&moc[O p&rograme]]&',cb_about)



Note that the letters S, O, n, k, U, M, Z, m, r after the start
of the program should appear underlined, what is not the case.
They appear underlined ONLY AFTER pressing the ALT key first.

Martin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7931
Location: Salford, UK

PostPosted: Sat May 09, 2020 8:49 am    Post subject: Reply with quote

Thanks Martin but I need a working program. Even it only takes 5 or 10 minutes for me to work out what are integers and what are callbacks, that is time that could be better used.
Back to top
View user's profile Send private message AIM Address
Martin_K



Joined: 09 Apr 2020
Posts: 227

PostPosted: Sat May 09, 2020 2:54 pm    Post subject: Reply with quote

Paul, of coarse, I do not to waste your time, so here is main program
with callbacks (I did not attach one call-back function called cb_open_in_out() which is pretty long, but to investigate the problem this callback is not relevant. I also did not attached another two subroutines for the same reason.

Remember to use UTF-8 without signature to use my source codes
(there are lot of slovak special characters, first of all in comments)

[code:1:fac2a8190a]
WINAPP

PROGRAM TXT_2_SGF_WIN_APP

! USE TXT_SGF
USE MSWIN

IMPLICIT NONE
! INCLUDE <windows.ins>
EXTERNAL sb_vstup3, sb_vstup4,knc, cont, cb_open_in_out, cb_znam, cb_about

INTEGER*4 button_grey_control, knc, cont, cb_open_in_out, cb_znam, cb_about !!!pokracuj
INTEGER*4 ans, w, h, sb_vstup3, sb_vstup4, i, vybrate, kod, test, button_grey_control_mapa

LOGICAL STOP_PROCESSING_2

CHARACTER*129 subor3, subor4 ! Deklar�cia premenn�ch (vstupn� a v�stupn� s�bor) vr�tane cesty k nim
CHARACTER*1 zmena(2) ! Deklar�cia pre v�ber v combo boxe (a alebo n)
CHARACTER*181 b1_h, b2_h, b3_h ! Deklar�cia HELP reťazcov
CHARACTER*20 b4_h
DATA (zmena(i), i=1,2)/'a','n'/

COMMON/retazec1/subor3
COMMON/retazec2/subor4
COMMON/cel_cisla1/button_grey_control
COMMON/cel_cisla2/vybrate
COMMON/zmena_znam/zmena
COMMON/testovanie1/kod
COMMON/testovanie2/test
COMMON/kontrola/STOP_PROCESSING_2
COMMON/grafika/button_grey_control_mapa


STOP_PROCESSING_2 = .FALSE. !to je pre externu funkciu KON_2, ktor� sa vyvola pri kontrole vstupneho suboru, ak sa v nom najde chyba v subroutine
!Konverzia_TXT_2_SGF-input

test = -1
kod = -1

b1_h='Textov� s�bor so 7-riadkovou hlavičkou a hodnotami'//char(10)//' X,Y,DX,DY v tvare nepravouholn�kovej mrie�ky, '//char(10)//&
&'(hodnoty X,Y nie s� zoraden� vzostupne)'
b2_h='V�stupn� s�bor, do ktor�ho sa zap�u hodnoty X,Y,DX,DY vo'//char(10)//' vzostupnom porad� doplnen� hodnotami X,Y,&
& pre ktor� DX=0, DY=0,'//char(10)//'aby sa vytvorila pravouholn�kov� mrie�ka bodov'
b3_h='Po zvolen� vst. a v�st. s�boru sa kliknut�m'//char(10)//'na tento gomb�k spust� konverzia �dajov'
b4_h='Ukončenie programu'

w=830
h=490

subor3='.txt'
subor4='.txt'

button_grey_control = 0
button_grey_control_mapa = 0

ans=winio@('%sz&',w,h)

ans=winio@('%ww[thin_border]&')

ans=winio@('%ca[Program: TXT_2_SGF, � Martin Kalafut]&')

ans=winio@('%mn[&S�bor[&Otvoriť s�bor,~Zme&niť znamienka pre DX a DY]]&',cb_open_in_out,button_grey_control,cb_znam)
ans=winio@('%mn[[~Začať &konverziu,|,&Ukončiť]]&',button_grey_control,cont,knc)
ans=winio@('%mn[&Mapa[~&Zobraziť]]&',button_grey_control_mapa,knc)
ans=winio@('%mn[Po&moc[O p&rograme]]&',cb_about)

ans=winio@('%4nl%ta%bf%fn[Courier New]Zvoľ vstupn� TXT s�bor:%4ta%bc[yellow]%`^?bt[&Vybrať vstupn� s�bor]@%`bh&',&
'FILE_OPENR[Zvoľ s�bor]',subor3,sb_vstup3,b1_h,1)

ans=winio@('%bg[grey]&')

ans=winio@('%2nl%ta%sf%bf%fn[Courier New]%ob%80st%cb&',subor3)

ans=winio@('%3nl%ta%bf%fn[Courier New]Zvoľ v�stupn� TXT s�bor:%4ta%bc[yellow]%~^?bt[&Vy&brať v�stupn� s�bor]@%`bh&',&
button_grey_control,'FILE_OPENW[Zvoľ s�bor]',subor4,sb_vstup4,b2_h,1)

ans=winio@('%2nl%ta%sf%bf%fn[Courier New]%ob%80st%cb&',subor4)

vybrate=1

ans=winio@('%3nl%ta%bf%fn[Courier New]Zmeniť zn. pred DX a DY vo v�s
Back to top
View user's profile Send private message
Martin_K



Joined: 09 Apr 2020
Posts: 227

PostPosted: Sat May 09, 2020 3:01 pm    Post subject: Reply with quote

Sorry, something went wrong, so again:

[code:1:709923b2e5]
WINAPP

PROGRAM TXT_2_SGF_WIN_APP

! USE TXT_SGF
USE MSWIN

IMPLICIT NONE
! INCLUDE <windows.ins>
EXTERNAL sb_vstup3, sb_vstup4,knc, cont, cb_open_in_out, cb_znam, cb_about

INTEGER*4 button_grey_control, knc, cont, cb_open_in_out, cb_znam, cb_about !!!pokracuj
INTEGER*4 ans, w, h, sb_vstup3, sb_vstup4, i, vybrate, kod, test, button_grey_control_mapa

LOGICAL STOP_PROCESSING_2

CHARACTER*129 subor3, subor4 ! Deklar�cia premenn�ch (vstupn� a v�stupn� s�bor) vr�tane cesty k nim
CHARACTER*1 zmena(2) ! Deklar�cia pre v�ber v combo boxe (a alebo n)
CHARACTER*181 b1_h, b2_h, b3_h ! Deklar�cia HELP reťazcov
CHARACTER*20 b4_h

DATA (zmena(i), i=1,2)/'a','n'/

COMMON/retazec1/subor3
COMMON/retazec2/subor4
COMMON/cel_cisla1/button_grey_control
COMMON/cel_cisla2/vybrate
COMMON/zmena_znam/zmena
COMMON/testovanie1/kod
COMMON/testovanie2/test
COMMON/kontrola/STOP_PROCESSING_2
COMMON/grafika/button_grey_control_mapa


STOP_PROCESSING_2 = .FALSE. !to je pre externu funkciu KON_2, ktor� sa vyvola pri kontrole vstupneho suboru, ak sa v nom najde chyba v subroutine
!Konverzia_TXT_2_SGF-input

test = -1
kod = -1

b1_h='Textov� s�bor so 7-riadkovou hlavičkou a hodnotami'//char(10)//' X,Y,DX,DY v tvare nepravouholn�kovej mrie�ky, '//char(10)//&
&'(hodnoty X,Y nie s� zoraden� vzostupne)'
b2_h='V�stupn� s�bor, do ktor�ho sa zap�u hodnoty X,Y,DX,DY vo'//char(10)//' vzostupnom porad� doplnen� hodnotami X,Y,&
& pre ktor� DX=0, DY=0,'//char(10)//'aby sa vytvorila pravouholn�kov� mrie�ka bodov'
b3_h='Po zvolen� vst. a v�st. s�boru sa kliknut�m'//char(10)//'na tento gomb�k spust� konverzia �dajov'
b4_h='Ukončenie programu'
!
! Prednastavenie veľkosti okna: w (width - počet stĺpcov) x h (height - počet riadkov), v�etko v pixeloch
!
w=830
h=490
!
! Inicializ�cia s�borov pre �tandardn� dial�gov� funkciu voľby s�borov OPEN_FILER. Je to potrebn� (t� inicializ�cia),
! keď�e bez toho by sa t�to funkcia spr�vala nevyspytateľne.
!
subor3='.txt'
subor4='.txt'

button_grey_control = 0
button_grey_control_mapa = 0
!
! umoznenie pisania diakritiky v texte
!
call ENABLE_UTF8@(1)

ans=winio@('%sz&',w,h)

ans=winio@('%ww[thin_border]&')

ans=winio@('%ca[Program: TXT_2_SGF, � Martin Kalafut]&')

ans=winio@('%mn[&S�bor[&Otvoriť s�bor,~Zme&niť znamienka pre DX a DY]]&',cb_open_in_out,button_grey_control,cb_znam)
ans=winio@('%mn[[~Začať &konverziu,|,&Ukončiť]]&',button_grey_control,cont,knc)
ans=winio@('%mn[&Mapa[~&Zobraziť]]&',button_grey_control_mapa,knc)
ans=winio@('%mn[Po&moc[O p&rograme]]&',cb_about)

ans=winio@('%4nl%ta%bf%fn[Courier New]Zvoľ vstupn� TXT s�bor:%4ta%bc[yellow]%`^?bt[&Vybrať vstupn� s�bor]@%`bh&',&
'FILE_OPENR[Zvoľ s�bor]',subor3,sb_vstup3,b1_h,1)

ans=winio@('%bg[grey]&')

ans=winio@('%2nl%ta%sf%bf%fn[Courier New]%ob%80st%cb&',subor3)


ans=winio@('%3nl%ta%bf%fn[Courier New]Zvoľ v�stupn� TXT s�bor:%4ta%bc[yellow]%~^?bt[&Vy&brať v�stupn� s�bor]@%`bh&',&
button_grey_control,'FILE_OPENW[Zvoľ s�bor]',subor4,sb_vstup4,b2_h,1)


ans=winio@('%2nl%ta%sf%bf%fn[Courier New]%ob%80st%cb&',subor4)

vybrate=1

ans=winio@('%3nl%ta
Back to top
View user's profile Send private message
Martin_K



Joined: 09 Apr 2020
Posts: 227

PostPosted: Sat May 09, 2020 3:05 pm    Post subject: Reply with quote

Paul,

probably the code is too long, I am unable to post it by copying it between
Code:

and


Could I send you an email with attached source code, if YES, can I send it tp
ftn95@silverfrost.com?

Martin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7931
Location: Salford, UK

PostPosted: Sat May 09, 2020 5:26 pm    Post subject: Reply with quote

Thanks Martin. I can work with what I have in your last post.
Back to top
View user's profile Send private message AIM Address
Robert



Joined: 29 Nov 2006
Posts: 446
Location: Manchester

PostPosted: Sun May 10, 2020 12:19 am    Post subject: Reply with quote

Quote:
But, when I start the program, initially - I see NO underlined letters in menu (and submenu - if available) items. They (the underlined letters) are ONLY then visible, when I physically press the ALT key on the keyboard first (then they appear and function as expected).


Isn't that normal? The underlines don't appear unless you press Alt.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7931
Location: Salford, UK

PostPosted: Mon May 11, 2020 9:18 am    Post subject: Reply with quote

I think that Robert is right and also that this feature is working correctly for UTF-8. Here is my test program...

Code:
winapp
program main
use clrwin
integer i
integer,external::cbfunc
call enable_utf8@(1)
i=winio@('%mn[&S�bor[&Otvoriť s�bor]]&',cbfunc)
i=winio@("%cn%bt[OK]")
end

integer function cbfunc()
integer i
i = winio@("%bt[ok]")
cbfunc = 2
end
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2390
Location: Yateley, Hants, UK

PostPosted: Wed May 13, 2020 11:47 am    Post subject: Reply with quote

The following may be useful:

Quote:
Underlining Access Keys
In versions of Windows prior to Microsoft Windows 2000, underlined access keys were visible at all times. In Windows 2000 and later versions, users can hide them if they do not use them.

If your application is using standard menus and dialog boxes, the behavior is automatic. However, applications that draw their own custom controls, such as menus and dialog boxes, must explicitly handle this appropriately. When you are deciding where to underline access keys, keep the following situations in mind:

Setting system parameters to display underlining for access keys.

Users can adjust the default settings for underlining through Control Panel. If the system parameter indicates that access keys are always underlined, an application will always display the underline below the access keys. (The default setting hides underlining.)

For information about these settings, see the SPI_GETMENUUNDERLINES or SPI_SETMENUUNDERLINES parameters for the SystemParametersInfo function in the Platform SDK.

Interacting with a menu or dialog box by using the keyboard.

A user can do the following:

Invoke a menu by pressing a key combination such as ALT, F10, or SHIFT+F10.
Invoke a menu by using a mouse but then navigate between menus by using the keyboard. After a user interacts with a menu by using the keyboard, all access keys must be underlined until the menu is closed.
Press a key to activate another control, such as when pressing the TAB key to move the input focus to the next control or pressing the SPACEBAR key to select an option control. The underline must remain displayed until the user closes the dialog box or container.


I have emphasised part of it. It comes from here:

https://docs.microsoft.com/en-us/previous-versions/windows/desktop/dnacc/guidelines-for-keyboard-user-interface-design#common-keyboard-ui-design-mistakes-and-limitations

Eddie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group