@@ -25,7 +25,7 @@ The widget displays a row of navigation items. Each of these has a
2525<itemIcons|icon>, or both. All of the navigation item data is
2626available as a single array via the <itemArray> property.
2727
28- At any time, one of the navigation items may be
28+ At any time, zero or one of the navigation items may be
2929<hilitedItemName|highlighted>. This is useful, for example, for
3030indicating the current card. When the user clicks one of the
3131navigation items, the widget sends a <hiliteChanged> message.
@@ -117,7 +117,7 @@ use com.livecode.library.widgetutils
117117
118118-- adding metadata to ensure the extension displays correctly in livecode
119119metadata author is "LiveCode"
120- metadata version is "2.0 .0"
120+ metadata version is "2.1 .0"
121121metadata title is "Navigation Bar"
122122metadata preferredSize is "320,49"
123123metadata svgicon is "M0,0v29.5h80.2V0H0z M21.1,21.5c-0.2-0.1-0.4-0.2-0.4-0.2c-0.5-0.2-0.9-0.3-1.4-0.4c-0.7-0.1-0.9-0.4-0.9-1.1c0-0.1-0.1-0.9,0-1c0.4-0.2,0.5-0.9,0.5-1.3c0-0.3,0.2-0.5,0.3-0.7c0.2-0.3,0.2-0.6,0.3-0.9c0.1-0.2,0.2-0.6,0.1-0.8c0-0.2-0.2-0.4-0.2-0.6c0-0.3,0.1-0.6,0.1-0.9c0-0.5,0-0.9,0-1.4c-0.2-1.2-1.4-1.6-2.5-1.9c-1-0.2-2.2,0.3-2.9,1c-0.3,0.3-0.6,0.7-0.7,1.1c-0.1,0.4,0,0.9,0,1.2c0,0.2,0,0.4,0.1,0.6c0,0.2,0.1,0.3,0.1,0.5c0,0.1-0.1,0.2-0.1,0.3c-0.2,0.4,0,1,0.2,1.4c0.1,0.2,0.2,0.4,0.3,0.5c0.2,0.2,0.2,0.3,0.2,0.6c0,0.4,0.1,1.2,0.6,1.4c0.1,0.1,0,0.8-0.1,0.9c0,0.7,0,1-0.6,1.1c-0.5,0.1-0.9,0.2-1.4,0.4c-0.2,0.1-0.4,0.2-0.7,0.3c-2-1.4-3.4-3.8-3.4-6.4c0-4.3,3.5-7.8,7.8-7.8s7.8,3.5,7.8,7.8C24.3,17.8,23,20.1,21.1,21.5z M45.1,22.7l-4.9-3.6v-0.7l0.2,0.2l3.6,2.6L42.6,17l-0.1-0.4l0.3-0.3l3.4-2.5H42h-0.4l-0.1-0.4l-1.4-4.2l-1.4,4.2l-0.1,0.4h-0.4h-4.3l3.4,2.5l0.3,0.3L37.5,17l-1.4,4.2l3.6-2.6l0.2-0.2v0.7L35,22.7l1.9-5.9l-4.9-3.6h6.1l1.9-5.9l1.9,5.9h6.1l-4.9,3.6L45.1,22.7z M71.1,23.1l-4.9-4.9c-1,0.9-2.4,1.4-3.9,1.5V19c3-0.1,5.4-2.5,5.4-5.5c0-3.1-2.5-5.5-5.5-5.5c-3.1,0-5.5,2.5-5.5,5.5c0,3,2.4,5.4,5.4,5.5v0.7c-3.4-0.1-6-2.8-6-6.2c0-3.4,2.8-6.2,6.2-6.2c3.4,0,6.2,2.8,6.2,6.2c0,1.5-0.6,2.9-1.5,4l4.9,4.9L71.1,23.1z"
@@ -241,9 +241,11 @@ Description:
241241The names of the icons displayed by the navigation items when not
242242highlighted.
243243
244- Each icon name must be one of the predefined graphics provided by the "IconSVG"
244+ Each icon name must be one of the graphics supplied by the "IconSVG"
245245library. You can get a list of available predefined path names by running
246- `put iconNames()` in the Message Box.
246+ `put iconNames()` in the Message Box. See the
247+ <com.livecode.library.iconsvg|Icon SVG Library>
248+ documentation for handlers to manage user icon families.
247249
248250Setting the <itemIcons> can add items to the navigation bar. If the
249251new value of the <itemIcons> has more items than the navigation bar,
@@ -256,7 +258,7 @@ navigation bar, the remaining navigation items have their icons reset
256258to the default icon.
257259
258260References: hilitedItemIcons(property), itemLabels(property),
259- itemNames(property)
261+ itemNames(property), com.livecode.library.iconsvg (library)
260262
261263*/
262264property itemIcons get getNavIcons set setNavIcons
@@ -273,9 +275,11 @@ Description:
273275The names of the icons displayed by the navigation items when
274276highlighted.
275277
276- Each icon name must be one of the predefined graphics provided by the "IconSVG"
278+ Each icon name must be one of the graphics supplied by the "IconSVG"
277279library. You can get a list of available predefined path names by running
278- `put iconNames()` in the Message Box.
280+ `put iconNames()` in the Message Box. See the
281+ <com.livecode.library.iconsvg|Icon SVG Library>
282+ documentation for handlers to manage user icon families.
279283
280284Setting the <hilitedItemIcons> can add items to the navigation bar.
281285If the new value of the <hilitedItemIcons> has more items than the
@@ -287,7 +291,8 @@ If the new value of the <hilitedItemIcons> has fewer items than the
287291navigation bar, the remaining navigation items have their
288292highlighted-state icons reset to the default icon.
289293
290- References: itemIcons(property), itemLabels(property), itemNames(property)
294+ References: itemIcons(property), itemLabels(property), itemNames(property),
295+ com.livecode.library.iconsvg (library)
291296*/
292297property hilitedItemIcons get getNavSelectedIcons set setNavSelectedIcons
293298metadata hilitedItemIcons.user_visible is "false"
@@ -354,7 +359,9 @@ Value(integer): The item number of the navigation item that is highlighted.
354359
355360Description:
356361The <hilitedItem> is the item number of the currently-highlighted navigation
357- item, starting from 1. It can be used as a key into the <itemArray>.
362+ item. It can be used as a key into the <itemArray>.
363+
364+ Setting 0 will cause nothing to be highlighted.
358365
359366Related: hilitedItemName (property)
360367
@@ -365,7 +372,7 @@ metadata hilitedItem.editor is "com.livecode.pi.integer"
365372metadata hilitedItem.default is "1"
366373metadata hilitedItem.label is "Selected item index"
367374metadata hilitedItem.step is "1"
368- metadata hilitedItem.min is "1 "
375+ metadata hilitedItem.min is "0 "
369376
370377/**
371378Syntax: set the hilitedItemName of <widget> to <pName>
@@ -377,7 +384,7 @@ Value(string): The name of the navigation item that is highlighted.
377384
378385Description:
379386The <hilitedItemName> is the name of the currently-highlighted navigation
380- item.
387+ item. If nothing is highlighted, the value is an empty string.
381388
382389References: hilitedItem (property)
383390*/
@@ -1249,7 +1256,7 @@ end handler
12491256
12501257public handler setNavSelectedItem(in pSelectedItem as Integer) returns nothing
12511258 if pSelectedItem is not mSelectedItem and \
1252- pSelectedItem > 0 and \
1259+ pSelectedItem >= 0 and \
12531260 pSelectedItem <= the number of elements in mNavData then
12541261 put pSelectedItem into mSelectedItem
12551262 post "hiliteChanged"
@@ -1260,10 +1267,15 @@ end handler
12601267public handler setNavSelectedItemName(in pName as String) returns nothing
12611268 variable tCount as Integer
12621269 variable tItem as Array
1263-
1270+
1271+ if pName is "" then
1272+ setNavSelectedItem(0)
1273+ return
1274+ end if
1275+
12641276 -- Find the item index corresponding to pName and set it as the
12651277 -- currently-highlighted item.
1266-
1278+
12671279 repeat with tCount from 1 up to the number of elements in mNavData
12681280 put mNavData[tCount] into tItem
12691281 if tItem["name"] is pName then
@@ -1275,7 +1287,11 @@ public handler setNavSelectedItemName(in pName as String) returns nothing
12751287end handler
12761288
12771289public handler getNavSelectedItemName() returns String
1278- return mNavData[mSelectedItem]["name"]
1290+ if mSelectedItem = 0 then
1291+ return ""
1292+ else
1293+ return mNavData[mSelectedItem]["name"]
1294+ end if
12791295end handler
12801296
12811297public handler setItemStyle(in pItemStyle as String) returns nothing
0 commit comments