GithubHelp home page GithubHelp logo

revig / universal-button-widget Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 3.0 679 KB

A LCB widget which can be used as a button, as a toggle-button and as a segmented control.

License: MIT License

livecode livecodescript

universal-button-widget's Introduction

LiveCode universal button widget

This LCB widget can be used as a button, as a toggle-button and as a segmented control if multiple buttons are combined in a group. The widget responds to mouseDown, mouseUp, mouseCancel, mouseEnter and mouseLeave messages. It has a default state and a "highlighted" state. It can display an SVG icon or (multiline) text only or both. Icon and text can be different in the respective states. Every button corner can be rounded separately. The widget icon can be placed independently of the label. The size of the icon can be customized. There are lots of properties which can be adjusted, please see the documentation you can load using the Extension Manager, or search the dictionary for "Universal Button".

Segmented control demo:

There is a demo stack (universalControlStack.livecode) included which demonstrates how to mimic a segmented control by using grouped button widgets.

Instructions:

Note: Before opening the demo stack you should install the LCB universal button extension (community.livecode.rabit.universalbutton.1.4.0.lce) which is located in the "universalButtonSource" folder of the "universal-button-widget" package. Then open the stack and follow the instructions contained in the stack.

License

For the license terms see the LICENSE file.

Meta

Version: 1.4.0 Web Site: https://revigniter.com/

Author: Ralf Bitter

universal-button-widget's People

Contributors

mwieder avatar revig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

universal-button-widget's Issues

Error with v1.1.0

Hi Ralf - I installed v1.1.0 and opened a stack using several universal buttons (as of v1.0.6).
The buttons would not show, instead got this error message:
"array key does not exist"
LCB line: 711

Reinstalled v1.0.6 and all works again.

Hope there's an easy fix. I use your universal-button everywhere nowadays - thanks for this great resource! :)

Test of ubFormattedWidth

I did a test of a Universal button similar to "next card>" where the ">" is a SVG drawing, supposily always aligned right.
Label is aligned left
Icon gravity is right
The change of label is not reflected on the formatted width, being herratic...Please note: the width in msg is opposite to the width in the property inspector.
The only way to make it works is to put a "wait x seconds with messages" after the change of label and before the ubFormattedWidth function
Any help is appreciated. Thanks

This is the code, from another button, used to verify the formatted width:

on mouseUp pMouseButton
     put the topRight of  widget "UbtnTest"  into tTopRight
     put the buttonText of widget "UbtnTest" into tLabel
     if tLabel = "next card" then
          set the buttonText of widget "UbtnTest" to "up"
     else
          set the buttonText of widget "UbtnTest" to "next card"
     end if
--wait 1 seconds with messages
     put the ubFormattedWidth of widget "UbtnTest" into tWidth
     put tWidth into msg
     set the width of widget "UbtnTest" to tWidth 
     set the topRight of widget "UbtnTest" to tTopRight
end mouseUp

Feature request: icon position/gravity

Dear Ralf, thanks for this excellent widget, there isn't really much at all to fault it.
The only missing feature is FileMaker Pro-style positioning of the SVG icon (left/top/right/bottom), akin to gravity on an LC button graphic and I'm hoping you'd consider this feature request...
Many thanks,
Stam

Localisation and formattedwidth

Great work !!! thanks.
Having languange localisation in my standalone, the label of the UBW may vary in length.
I noticed that the widget does not account for formattedwidth.
Most of my buttons have the SVG icon on the left and the label text on the right, right aligned.
Even if place the UBW in a group, after changing the widget label, the formattedwidth always report 0, both of the widget and of the group.
Am I missing something?
Thanks again. Keep improving this product, please.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.