Bwidget Source Code
Check-in [31afcaf544]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Rudimentary French localisation, help not on on by default (compatibility), ChangeLog
Timelines: family | ancestors | descendants | both | patch-75101
Files: files | file ages | folders
SHA3-256: 31afcaf544477cac4c6125f7a91015d6c5e0e72ce6e65bac140a5e5302b2b5f3
User & Date: oehhar 2018-01-09 17:45:36
Context
2018-01-09
17:54
Merge fontchooser extensions: hex entry/display, help, title frames, user choice callback. Ticket [75101bf5ce] check-in: 5f374d671e user: oehhar tags: bwidget
17:45
Rudimentary French localisation, help not on on by default (compatibility), ChangeLog Closed-Leaf check-in: 31afcaf544 user: oehhar tags: patch-75101
2017-10-28
00:18
REVISIONS TO color.tcl

1. Remove option -variable 2. Remove variable _varName which held the value of option -variable 3. Use variable _unsavedSelection in place of $_varName when a value must be stored 4. Add option -command 5. Add variable _command which holds the value of option -command 6. Set the default value for option -help to 1 7. Add command _userCommand to evaluate $_command at stack level #0. _userCommand is called whenever the selected color changes, i.e. instead of setting $_varName. 8. To avoid issues with trace, fully qualify ::SelectColor::_unsavedSelection when its value is set or it is used in a trace command. 9. Use 8.4-compatible syntax for string indices in "string range" commands. 10. Amend SelectColor::_SetWithoutTrace so it sets the colors in the Color Selectors when the value in the entry widget changes.

PURPOSE Tracing the variable set by the "-variable" option is too awkward in practice, and so the "-variable" option has been replaced with "-command" which allows the caller to specify a command to be executed whenever the selected color changes.

The use of the -command option is now included in the demo.

The properties of DynamicHelp balloon help have been changed in the demo, to make the text easier to read.

The manual page has been updated to reflect the changes in color.tcl. check-in: 9f462bd2fa user: kjnash tags: patch-75101

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
2017-##-## ########
	
	* color.tcl: New option -variable allows to give a
	traceable variable with current user color choice.
	New option -background and command SelectColor for
	window background.
	TitleFrames, Dynamic help and Aqua native buttons used.
	Show current choice by highlighting, not focus, to avoid
	conflict with keyboard traversal.
	Shows entry widget for numerical color input/output.

	Patch by Keith J. Nash [Patch 75101]

2017-08-25 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.11 tagged ****

2017-05-08 Harald Oehlmann
|

|
|






>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2018-01-09 Harald Oehlmann <[email protected]>
	
	* color.tcl: New option -command allows to get a callback
	when the user does an unvalidated choice.
	New option -background and command SelectColor for
	window background.
	TitleFrames, Dynamic help and Aqua native buttons used.
	Show current choice by highlighting, not focus, to avoid
	conflict with keyboard traversal.
	Shows entry widget for numerical color input/output.
        New option -help to show a help area.
	Patch by Keith J. Nash [Patch 75101]

2017-08-25 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.11 tagged ****

2017-05-08 Harald Oehlmann

Changes to color.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
...
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
namespace eval SelectColor {
    Widget::define SelectColor color Dialog

    Widget::declare SelectColor {
        {-title      String     "Select a color" 0}
        {-parent     String     ""               0}
        {-command    String     ""               0}
        {-help       Boolean    1                1}
        {-color      TkResource ""               0 {label -background}}
	{-type       Enum       "dialog"         1 {dialog popup}}
	{-placement  String     "center"         1}
        {-background TkResource ""               0 {label -background}}
    }

    variable _baseColors {
................................................................................
# digits long.
# ------------------------------------------------------------------------------

proc SelectColor::_SetEntryValue {argVarName var2 op} {
    variable _entryColor
    variable _unsavedSelection

    if {0} {
    } elseif {[string equal $argVarName ::SelectColor::_unsavedSelection] &&
            [string equal $var2 {}] && [string equal $op "write"]} {
        # OK
    } else {
        # Unexpected call
        return -code error "Unexpected trace of variable\
                \"$argVarName\", \"$var2\", \"$op\""
    }






|







 







<
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
...
819
820
821
822
823
824
825

826
827
828
829
830
831
832
833
namespace eval SelectColor {
    Widget::define SelectColor color Dialog

    Widget::declare SelectColor {
        {-title      String     "Select a color" 0}
        {-parent     String     ""               0}
        {-command    String     ""               0}
        {-help       Boolean    0                1}
        {-color      TkResource ""               0 {label -background}}
	{-type       Enum       "dialog"         1 {dialog popup}}
	{-placement  String     "center"         1}
        {-background TkResource ""               0 {label -background}}
    }

    variable _baseColors {
................................................................................
# digits long.
# ------------------------------------------------------------------------------

proc SelectColor::_SetEntryValue {argVarName var2 op} {
    variable _entryColor
    variable _unsavedSelection


    if {[string equal $argVarName ::SelectColor::_unsavedSelection] &&
            [string equal $var2 {}] && [string equal $op "write"]} {
        # OK
    } else {
        # Unexpected call
        return -code error "Unexpected trace of variable\
                \"$argVarName\", \"$var2\", \"$op\""
    }

Changes to lang/da.rc.

22
23
24
25
26
27
28

29
30
31
32
33
34
35
..
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
*italicName:        Kursiv
*underlineName:     Understreg
*overstrikeName:    Overstreg
*fontName:          &Font
*sizeName:          &Størrelse
*styleName:         St&il
*colorPickerName:   F&arve...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Brugernavn
*passwordName: &Password


................................................................................
! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Besked
*MessageDlg.infoTitle:      Information
*MessageDlg.questionTitle:  Spørgsmål
*MessageDlg.warningTitle:   Advarsel
*MessageDlg.errorTitle:     Fejl


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Indtast brugernavn og password

! --- symbolic names of label of SelectColor dialog ----------------------------







>







 







<







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
..
43
44
45
46
47
48
49

50
51
52
53
54
55
56
*italicName:        Kursiv
*underlineName:     Understreg
*overstrikeName:    Overstreg
*fontName:          &Font
*sizeName:          &Størrelse
*styleName:         St&il
*colorPickerName:   F&arve...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Brugernavn
*passwordName: &Password


................................................................................
! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Besked
*MessageDlg.infoTitle:      Information
*MessageDlg.questionTitle:  Spørgsmål
*MessageDlg.warningTitle:   Advarsel
*MessageDlg.errorTitle:     Fejl


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Indtast brugernavn og password

! --- symbolic names of label of SelectColor dialog ----------------------------

Changes to lang/es.rc.

11
12
13
14
15
16
17

18
19
20
21
22
23
24
..
28
29
30
31
32
33
34

35
36
37
38
39
40
41
..
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
*abortName:    A&bortar
*retryName:    &Reintentar
*ignoreName:   &Ignorar
*okName:       &OK
*cancelName:   &Anular
*yesName:      &Sí 
*noName:       &No


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          &Negrita
*italicName:        &Cursiva
*underlineName:     &Subrayado
*overstrikeName:    &Tachado
................................................................................
*colorPickerName:   &Color...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    Nombre de &usuario
*passwordName: &Contraseña 


! --- resource for SelectFont dialog ------------------------------------------

*SelectFont.title:        Selección de fuente
*SelectFont.sampletext:   Texto de Ejemplo


................................................................................
! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Indicación
*MessageDlg.infoTitle:      Información
*MessageDlg.questionTitle:  Pregunta
*MessageDlg.warningTitle:   Atención
*MessageDlg.errorTitle:     Error


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Introduzca su nombre de usuario y contraseña

! --- symbolic names of label of SelectColor dialog ----------------------------







>







 







>







 







<







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
..
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
..
44
45
46
47
48
49
50

51
52
53
54
55
56
57
*abortName:    A&bortar
*retryName:    &Reintentar
*ignoreName:   &Ignorar
*okName:       &OK
*cancelName:   &Anular
*yesName:      &Sí 
*noName:       &No


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          &Negrita
*italicName:        &Cursiva
*underlineName:     &Subrayado
*overstrikeName:    &Tachado
................................................................................
*colorPickerName:   &Color...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    Nombre de &usuario
*passwordName: &Contraseña 


! --- resource for SelectFont dialog ------------------------------------------

*SelectFont.title:        Selección de fuente
*SelectFont.sampletext:   Texto de Ejemplo


................................................................................
! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Indicación
*MessageDlg.infoTitle:      Información
*MessageDlg.questionTitle:  Pregunta
*MessageDlg.warningTitle:   Atención
*MessageDlg.errorTitle:     Error


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Introduzca su nombre de usuario y contraseña

! --- symbolic names of label of SelectColor dialog ----------------------------

Changes to lang/fr.rc.

10
11
12
13
14
15
16

17
18
19
20
21
22
23
..
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
*abortName:    A&bandonner
*retryName:    &Réessayer
*ignoreName:   &Ignorer
*okName:       &OK
*cancelName:   &Annuler
*yesName:      &Oui
*noName:       &Non


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          &Gras
*italicName:        &Italique
*underlineName:     &Souligné
*overstrikeName:    &Barré
................................................................................

*MessageDlg.noneTitle:      Message
*MessageDlg.infoTitle:      Information
*MessageDlg.questionTitle:  Question
*MessageDlg.warningTitle:   Attention
*MessageDlg.errorTitle:     Erreur


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Entrez le login et le mot de passe

! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Base colors
*userColorsName: User colors

*yourSelectionName: Your Selection
*colorSelectorsName: Color Selectors
*hoverHelpName: Hover for help with color selection by:
*mouseHelpName: Mouse
*keyboardHelpName: Keyboard

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank.  If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.

*keyboardHelpTextName: Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key.  The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.






>







 







<






|
|

|
|
|
|
|



|

|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
*abortName:    A&bandonner
*retryName:    &Réessayer
*ignoreName:   &Ignorer
*okName:       &OK
*cancelName:   &Annuler
*yesName:      &Oui
*noName:       &Non


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          &Gras
*italicName:        &Italique
*underlineName:     &Souligné
*overstrikeName:    &Barré
................................................................................

*MessageDlg.noneTitle:      Message
*MessageDlg.infoTitle:      Information
*MessageDlg.questionTitle:  Question
*MessageDlg.warningTitle:   Attention
*MessageDlg.errorTitle:     Erreur


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Entrez le login et le mot de passe

! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Couleurs de base
*userColorsName: Couleurs utilisateur

*yourSelectionName: Votre selection
*colorSelectorsName: Gamme des Couleurs
*hoverHelpName: Placez dessus pour afficher aide sur utilisation:
*mouseHelpName: Sourie
*keyboardHelpName: Clavier

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Cliquez ou tirez avec la sourie dans la gamme des couleurs pour choisir une couleur.\nModifie la valeur de saturation a droite, si la couleur reste noir ou blanc.\n\nClickez sur couleurs de base pour choisir une de ces couleurs.\nCliquez sur une couleur d'utilisateur pour la choisir ou la modifier si libre.

*keyboardHelpTextName: Cliquez dans le champ d'entré dans "votre selection". Entrez la couleur en notation hexadecimal RVB.\nL'entré de couleur est valable, si 3, 6 ou 9 characters sont entrés. La touche Entré valide l'entré et montre la couleur en clair et comme valeur de 24bit.\nSi le point focal n'est pas sur le champ d'entré, les touches Entrée et Échape fonctionnent comme\nles buttons "OK" et "Abadonner".

Changes to lang/hu.rc.

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
*MessageDlg.warningTitle:   Figyelmeztetés
*MessageDlg.errorTitle:     Hiba

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Add meg a felhasználónevet és a jelszót


! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Alapszínek
*userColorsName: Felhasználói színek


*yourSelectionName: Your Selection
*colorSelectorsName: Color Selectors
*hoverHelpName: Hover for help with color selection by:
*mouseHelpName: Mouse
*keyboardHelpName: Keyboard

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank.  If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.

*keyboardHelpTextName: Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key.  The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.






<




<












48
49
50
51
52
53
54

55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70
*MessageDlg.warningTitle:   Figyelmeztetés
*MessageDlg.errorTitle:     Hiba

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Add meg a felhasználónevet és a jelszót


! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Alapszínek
*userColorsName: Felhasználói színek


*yourSelectionName: Your Selection
*colorSelectorsName: Color Selectors
*hoverHelpName: Hover for help with color selection by:
*mouseHelpName: Mouse
*keyboardHelpName: Keyboard

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank.  If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.

*keyboardHelpTextName: Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key.  The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.

Changes to lang/pl.rc.

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
*MessageDlg.questionTitle:  Pytanie
*MessageDlg.warningTitle:   Ostrzeżenie
*MessageDlg.errorTitle:     Błąd

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Wpisz login i hasło


! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Kolory podstawowe
*userColorsName: Kolory niestandardowe

*yourSelectionName: Your Selection






<







47
48
49
50
51
52
53

54
55
56
57
58
59
60
*MessageDlg.questionTitle:  Pytanie
*MessageDlg.warningTitle:   Ostrzeżenie
*MessageDlg.errorTitle:     Błąd

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Wpisz login i hasło


! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Kolory podstawowe
*userColorsName: Kolory niestandardowe

*yourSelectionName: Your Selection