02-18-2023 12:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-18-2023 12:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
How is this not working?
Using code from
https://dev.fitbit.com/build/guides/user-interface/svg-components/buttons/
widget.defs
<link rel="import" href="/mnt/sysassets/system_widget.defs" />
index.view
<svg class="background">
<use href="#text-button">
<set href="#text" attributeName="text-buffer" to="BUTTON" />
</use>
</svg>
result is:
[21:26:03]Error 22 Could not find symbol '#text-button' resources/index.view:2,1
[21:26:03]Error 22 Undefined attribute 'href' resources/index.view:2,1
[21:26:03]Error 22 Could not find element '#text' resources/index.view:3,1
[21:26:03]App Started
Author | ch, passion for improvement.
Answered! Go to the Best Answer.

Accepted Solutions
02-18-2023 23:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-18-2023 23:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Thanks @kozm0naut @Gondwana - in the end was simpler to create a toggle button manually in SDK 6
<svg >
<rect x="10%" y="30%" height="20%" width="80%"fill="fb-yellow"/>
<rect x="11%" y="31%" height="18%" width="78%" fill="fb-black"/>
<text x="40%" y="42%" fill="white" font-size="35" font-family="System-Bold" > Push</text>
<rect id="btn1" pointer-events="visible" x="10%" y="30%" height="20%" width="80%" fill="fb-yellow" opacity="0"/>
</svg>
<svg >
<rect x="10%" y="60%" height="20%" width="80%" fill="fb-yellow"/>
<rect x="11%" y="61%" height="18%" width="78%" fill="fb-black"/>
<text x="40%" y="72%" fill="white" font-size="35" font-family="System-Bold" > Pull</text>
<rect id="btn2" pointer-events="visible" x="10%" y="60%" height="20%" width="80%" fill="fb-yellow" opacity="0"/>
</svg>
Toggle opacity = 0.5 on mousedown and opacity = 0 on mouseup - works identical to SDK 4.
Sometimes the simple things work best!
Author | ch, passion for improvement.
02-18-2023 12:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-18-2023 12:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
<link rel="import" href="/mnt/sysassets/widgets/text_button.defs" />
Gondwana Software
02-18-2023 13:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-18-2023 13:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks Peter - works
How about for #square-button-toggle or equivalent for SDK 6?
Author | ch, passion for improvement.

02-18-2023 13:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-18-2023 13:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I think square button is deprecated. Its doco is here.
Gondwana Software
02-18-2023 13:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-18-2023 13:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks, I'm looking for toggle primarily.
Author | ch, passion for improvement.

02-18-2023 13:29 - edited 02-18-2023 13:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-18-2023 13:29 - edited 02-18-2023 13:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
The other problem is the text doesn't show
<use id="btn" href="#text-button" x="10%" y="$+7%" width="80%" fill="fb-green">
<set href="#text" attributeName="text-buffer" to="Push" />
</use>
All works fine with SDK 4.3, text shows and button toggles with mouse down/up
Author | ch, passion for improvement.

02-18-2023 20:59
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-18-2023 20:59
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Try dropping the "#" on the set href... I don't know why the usage is inconsistent between use and set.

02-18-2023 22:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-18-2023 22:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks @kozm0naut - that also seems to be accepted.
However there doesn't seem to be an equivalent TOGGLE button in SDK 6, whereas in SDK 4 pressing the button can highlight it and removing your finger removes the highlight.
As @Gondwana says, "#square-button-toggle" appears to be deprecated.
In other words "removed", often referred to as "progress".
But if it is not replaced by something better, seems more like forced obsolescence or lack of backward compatibility, often occurs from reinventing the wheel, only to find the original round one was better!.
Author | ch, passion for improvement.

02-18-2023 23:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-18-2023 23:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Thanks @kozm0naut @Gondwana - in the end was simpler to create a toggle button manually in SDK 6
<svg >
<rect x="10%" y="30%" height="20%" width="80%"fill="fb-yellow"/>
<rect x="11%" y="31%" height="18%" width="78%" fill="fb-black"/>
<text x="40%" y="42%" fill="white" font-size="35" font-family="System-Bold" > Push</text>
<rect id="btn1" pointer-events="visible" x="10%" y="30%" height="20%" width="80%" fill="fb-yellow" opacity="0"/>
</svg>
<svg >
<rect x="10%" y="60%" height="20%" width="80%" fill="fb-yellow"/>
<rect x="11%" y="61%" height="18%" width="78%" fill="fb-black"/>
<text x="40%" y="72%" fill="white" font-size="35" font-family="System-Bold" > Pull</text>
<rect id="btn2" pointer-events="visible" x="10%" y="60%" height="20%" width="80%" fill="fb-yellow" opacity="0"/>
</svg>
Toggle opacity = 0.5 on mousedown and opacity = 0 on mouseup - works identical to SDK 4.
Sometimes the simple things work best!
Author | ch, passion for improvement.
