Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 1f0397c

Browse files
committed
[[ bugfix-20121 ]] Icon Picker: Use a popup stack for icon property
Adds a Property Inspector editor stack svgiconfiter which allows the user to filter the icons by name. The stack can be closed without making a selection by using the Escape key. The svgicon editor now pops up the stack instead of the iconpicker widget.
1 parent d8e9db9 commit 1f0397c

File tree

4 files changed

+76
-6
lines changed

4 files changed

+76
-6
lines changed

Toolset/palettes/inspector/editors/com.livecode.pi.svgicon.behavior.livecodescript

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
script "com.livecode.pi.svgicon.behavior"
1+
script "com.livecode.pi.svgicon.behavior" with behavior "revInspectorEditorBehavior"
22
on editorInitialize
33
set the editorMinWidth of me to 0
44
set the editorMaxWidth of me to 0
@@ -30,11 +30,13 @@ end editorResize
3030
on mouseUp
3131
local tValue
3232
put the editorValue of me into tValue
33-
local tProperties
34-
put tValue into tProperties["selectedIcon"]
35-
popup widget "com.livecode.widget.iconpicker" at the clickLoc with properties tProperties
36-
if the result is empty and it is not tValue then
37-
set the iconPresetName of widget 1 of me to it
33+
set the dialogData to tValue
34+
35+
set the behavior of stack "com.livecode.pi.svgiconfilter" to the long id of stack "com.livecode.pi.svgiconfilter.behavior"
36+
modal stack "com.livecode.pi.svgiconfilter" at the clickLoc
37+
38+
if the dialogData is not tValue then
39+
set the iconPresetName of widget 1 of me to the dialogData
3840
end if
3941
valueChanged
4042
end mouseUp
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
script "com.livecode.pi.svgiconfilter.behavior"
2+
on preOpenStack
3+
set the text of field "FilterText" to "Search"
4+
set the filterString of widget "iconList" of me to empty
5+
set the showSelectedElement of widget "iconList" of me to false
6+
set the iconSize of widget "iconList" of me to 45
7+
set the selectedIcon of widget "iconList" of me to the dialogData
8+
9+
set the behavior of me to the long id of stack "com.livecode.pi.svgiconfilter.behavior"
10+
focus on nothing
11+
end preOpenStack
12+
13+
on mouseUp
14+
if the short name of the target is "iconList" then
15+
set the dialogData to the selectedIcon of widget "iconList" of me
16+
close this stack
17+
end if
18+
end mouseUp
19+
20+
on openField
21+
if the short name of the target is "FilterText" then
22+
if field "FilterText" is "Search" then
23+
set the text of field "FilterText" to empty
24+
end if
25+
end if
26+
end openField
27+
28+
on enterField
29+
if the short name of the target is "FilterText" then
30+
if field "FilterText" is "Search" then
31+
set the text of field "FilterText" to empty
32+
end if
33+
end if
34+
end enterField
35+
36+
on closeField
37+
if the short name of the target is "FilterText" then
38+
if field "FilterText" is empty then
39+
set the text of field "FilterText" to "Search"
40+
end if
41+
end if
42+
end closeField
43+
44+
on exitField
45+
if the short name of the target is "FilterText" then
46+
if field "FilterText" is empty then
47+
set the text of field "FilterText" to "Search"
48+
end if
49+
end if
50+
end exitField
51+
52+
on textChanged
53+
local tFilterText
54+
55+
if the short name of the target is "FilterText" then
56+
put field "FilterText" into tFilterText
57+
set the filterString of widget "iconList" of me to tFilterText
58+
end if
59+
end textChanged
60+
61+
on returnInField
62+
// Do nothing
63+
end returnInField
64+
65+
on escapeKey
66+
close this stack
67+
end escapeKey
Binary file not shown.

notes/bugfix-20121.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Icon Picker: Use a popup stack for icon property setting to allow filtering

0 commit comments

Comments
 (0)