Creating Widgets
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Creating Widgets
Hello. I'm taking a stab creating a digital signage app in Live Code and could use some general guidance. My first question concerns the best way about building this. I envision an app that allows the user to choose, place on the screen and configure widgets such as clock, weather, tickets, etc.
In my head, I conceive this app as containing a main stack which would act as the canvas for placing these widgets and then substacks for each widget with a card for configuration and a card for display.
Is my thinking right on this? Or is there a better way?
In my head, I conceive this app as containing a main stack which would act as the canvas for placing these widgets and then substacks for each widget with a card for configuration and a card for display.
Is my thinking right on this? Or is there a better way?
On Twitter: @granata
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Creating Widgets
Hi.
You could. And do try it that way.
I always try to keep the number of stacks to a minimum. I would use a single mainstack, and image objects for your widgets. These can all have scripts, and call configuration panes or windows which can be placed on a single substack which might have different cards on it as they pertain to the widget in question. The widgets themselves can be hidden or shown as requested, perhaps pulled from a treasure chest.
Or some other way.
Craig Newman
You could. And do try it that way.
I always try to keep the number of stacks to a minimum. I would use a single mainstack, and image objects for your widgets. These can all have scripts, and call configuration panes or windows which can be placed on a single substack which might have different cards on it as they pertain to the widget in question. The widgets themselves can be hidden or shown as requested, perhaps pulled from a treasure chest.
Or some other way.
Craig Newman
Re: Creating Widgets
Craig, thanks for the help! I'll build a stack for each widget (there won't be many).
I've started by building a simple clock stack that consists of two cards, one that displays the time in a field and the other that allows the user to select the format for the time displayed. I also have a button on my main stack that toggles the locking of the widgets. A custom property (cLockWidgets) is toggled between true or false and, if set to true, the "clock widget" is locked into place. If set to false then the clock widget is able to be grabbed and moved around.
My challenge at this point is that I want to hide or show a configure button on the clock stack (and future stacks) depending on the value of cLockWidgets. Can you tell me the best way to go about this? I can accomplish it be specifically hiding or showing the button in an existing handler of the toggle button, but I feel like there must be a more efficient and scalable way.
I've started by building a simple clock stack that consists of two cards, one that displays the time in a field and the other that allows the user to select the format for the time displayed. I also have a button on my main stack that toggles the locking of the widgets. A custom property (cLockWidgets) is toggled between true or false and, if set to true, the "clock widget" is locked into place. If set to false then the clock widget is able to be grabbed and moved around.
My challenge at this point is that I want to hide or show a configure button on the clock stack (and future stacks) depending on the value of cLockWidgets. Can you tell me the best way to go about this? I can accomplish it be specifically hiding or showing the button in an existing handler of the toggle button, but I feel like there must be a more efficient and scalable way.
On Twitter: @granata
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Creating Widgets
I still think you are creating more cards or stacks than you need. Structurally, there is nothing wrong with this, but, for example, why have two cards for the time field and the format selection button? Why cannot they reside on the same card? You may have your reasons, but I just want to mention that new users frequently make lots of these objects, cards and stacks, when one might do.
Similarly, to me, hiding and showing objects is clean and simple to manage. Much better than creating separate cards to hold them. If you think about it, what is the difference between showing and hiding a card, (navigating) and showing and hiding an object on a single card?
But go ahead. Make the thing work, then think about streamlining.
Craig Newman
Similarly, to me, hiding and showing objects is clean and simple to manage. Much better than creating separate cards to hold them. If you think about it, what is the difference between showing and hiding a card, (navigating) and showing and hiding an object on a single card?
But go ahead. Make the thing work, then think about streamlining.
Craig Newman
Re: Creating Widgets
Craig,
You encouraged me to continue this way in your first response and, because the whole card/stack metaphor is one I easily wrap my mind around, I have no other reason than it is the path of least resistance. Maybe that is why other new users do the same.
In your previous post you mentioned using image objects for each widget. How would an image object contain something dynamic like a clock, slide show, ticker, etc?
You encouraged me to continue this way in your first response and, because the whole card/stack metaphor is one I easily wrap my mind around, I have no other reason than it is the path of least resistance. Maybe that is why other new users do the same.
In your previous post you mentioned using image objects for each widget. How would an image object contain something dynamic like a clock, slide show, ticker, etc?
On Twitter: @granata
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Creating Widgets
Why, it wouldn't.
Go for it.
Craig Newman
Go for it.
Craig Newman