custom 'widgets'

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

custom 'widgets'

Post by stam » Sat Oct 24, 2020 1:01 am

Hi all,

i've created a nice little pretend popover control which i've packaged in a group and it's a kind of pseudo-widget.
I right click on it to reveal configuration options (in dev environment only) but of course this has to be done in runtime.

Not a major issue, but is there anyway to put configuration options for this group/pseudowidget into the inspector/properties or would i have to build it as a 'proper' widget in LCB?

On that note, is there an easy way to make a group behave like a 'proper' widget or easy way to LCB it?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9658
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: custom 'widgets'

Post by dunbarx » Sat Oct 24, 2020 3:05 am

HI.

You cannot add your own stuff to the inspector. You could make your own inspector, though.

And if you already are in love with your gadget, what do you gain by making it a widget?

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9384
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: custom 'widgets'

Post by richmond62 » Sat Oct 24, 2020 10:11 am

what do you gain by making it a widget?
I am still trying to work out what is so big about widgets; the only thing I can see about
them is that, instead of stacks made by other users, they are extremely difficult to tweak to one's own needs,

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: custom 'widgets'

Post by stam » Sat Oct 24, 2020 10:18 am

Thanks for the answers both,

This is where my ignorance of the deeper workings of LC shines through -- even though i've committed most of my free time to LC over the last 3-4 months (admittedly not that much time!) and have progressed quite a bit in some areas, in others i'm still very much a beginner - for me a 'widget' and a 'gadget' are pretty much the same :D (I'm sure there are significant differences...)

@richmond62: In my mind a 'widget' is just an efficient way to reuse a structure - to package it so i can just drop it into a project. Whether this is called a 'widget' or a 'gadget' or whether it's build in LCB or not are secondary in my mind.

@dunbarx I only asked about the LC inspector as i came across a date picker by Hermann which actually modifies the inspector in a useful way, to allow you to directly set the properties for the date picker, and I was hoping this may be easily doable, as in other environments (like XOJO) it's trivially easy to define properties for a class that appear in the IDE's inspector so they can be modified easily in the IDE.

Really i don't really care about modifying the inspector - what i was aiming for was an easy way to set properties without having to switch from 'pointer tool' to 'browse tool' so i can set these (at present i have a subgroup that is made visible on right-click of the 'gadget' so i can set properties in the dev environment- so i have to switch to 'browse tool' do that and then switch back to 'pointer tool', just an annoying round-trip is all)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9384
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: custom 'widgets'

Post by richmond62 » Sat Oct 24, 2020 10:35 am

The properties of an object are stored in an array . . .

You can do this sort of thing:

Code: Select all

on mouseUp
   put the properties of grc "xxx" into propARRAY
   combine propARRAY by row
   put propARRAY into fld "fPROPS"
end mouseUp
-
Screenshot 2020-10-24 at 12.33.38.png
-
Attachments
Prop Lister.livecode.zip
Here's the stack.
(1.18 KiB) Downloaded 145 times

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: custom 'widgets'

Post by stam » Sat Oct 24, 2020 10:59 am

richmond62 wrote:
Sat Oct 24, 2020 10:35 am
You can do this sort of thing:
...
Thanks @richmond62 - i may be missing the point here so i apologise if i'm misunderstanding...
I know i can do that - and i already do something like this.

However i still have to switch to the runtime mode ("browse tool") to get/set props for the 'gadget'.
And because i'm inherently very lazy, i was hoping there would be a way to do this without actually switching tools - basically have an interactive element in the design mode ("pointer tool").

It may of course not be possible -- then again i'm sure i've seen add ons that effectively do this (provide user interaction in design mode) only I can't see how to do this...

To make this more concrete:
I have a fake 'popover' gadget to simulate popovers in MacOS (I used these extensively in FileMaker Pro and created a XOJO class to simulate the same).

The side on which arrow appears and where along the chosen side it appears can be modified in code, but in reality a lot of this can be set at design time - so i have a simple segmented control that sets the side on which the arrow appears and an another control to define where the arrow appears.
Only to set this in the IDE, i have to switch tools from 'pointer tool' to 'browse tool'.
And, as i mentioned, i'm really very lazy :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9384
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: custom 'widgets'

Post by richmond62 » Sat Oct 24, 2020 11:08 am

I think both us maybe missing each other's point. :D

Anyway: I've just knocked a stack together that has NO problem changing a property in BROWSE mode:

Code: Select all

on mouseUp
   if the label of me is "GO RED" then
      set the backgroundColor of grc "RP" to red
      set the label of me to "GO GREEN"
   else
      set the backgroundColor of grc "RP" to green
      set the label of me to "GO RED"
   end if
end mouseUp
-
Screenshot 2020-10-24 at 13.06.42.png
-
You can change any property via scripting.
Attachments
Flasher.livecode.zip
(893 Bytes) Downloaded 144 times
Last edited by richmond62 on Sat Oct 24, 2020 11:13 am, edited 1 time in total.

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: custom 'widgets'

Post by stam » Sat Oct 24, 2020 11:11 am

Aye probably :D
richmond62 wrote:
Sat Oct 24, 2020 11:08 am
I think both us maybe missing each other's point. :D
Anyway: I've just knocked a stack together that has NO problem chaging a property in BROWQSE mode:
What i'm trying to do is get/set the properties in DESIGN mode, not BROWSE mode ;)

Purely convenience thing and not really that important. Just feeding the lazy...

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9384
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: custom 'widgets'

Post by richmond62 » Sat Oct 24, 2020 11:12 am

DESIGN mode
Err, what's that?

Are you, possibly, trying to spin off a standalone that allows end-users to do some sort of programming
themselves?

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: custom 'widgets'

Post by stam » Sat Oct 24, 2020 11:52 am

richmond62 wrote:
Sat Oct 24, 2020 11:12 am
DESIGN mode
Err, what's that?

Are you, possibly, trying to spin off a standalone that allows end-users to do some sort of programming
themselves?
Sorry - that's just he name of 'Pointer tool' in my head.

No, i'm not trying to make a standalone for end-users to do programming themselves... I'm being super lazy and wanting to make my life 5% easier in the IDE. I guess this would kind of be like a plugin perhaps?

to clarify what I want to do:
Image

or maybe this just would a lot of work for not much gain...

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9384
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: custom 'widgets'

Post by richmond62 » Sat Oct 24, 2020 11:57 am

DESIGN mode

Popever

Wittgenstein's private language

Erm?

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: custom 'widgets'

Post by stam » Sat Oct 24, 2020 12:33 pm

A popover is a standard interface element on many platforms (with variations) - It's not 'private language'

Image

There is no ready made equivalent in LiveCode so rolling my own and faking it.

More info here:
Wikipedia
Pop-up, popover or popper? — a quick look into UI terms


I'm happy to be corrected on 'design mode' in LiveCode -- what do you call this mode? ('pointer tool mode' doesn't sit well with me but happy to use this if that's the accepted norm). 'Edit mode'?

I do want to make sure i'm speaking the same language as everyone else here so i'm clear :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9384
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: custom 'widgets'

Post by richmond62 » Sat Oct 24, 2020 1:48 pm

Aha.

Well: I can see how you can prepare popover shapes, but to dim the surroundings, presumably, involves
images with a semi-transparent section.
Last edited by richmond62 on Sat Oct 24, 2020 2:03 pm, edited 2 times in total.

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: custom 'widgets'

Post by Klaus » Sat Oct 24, 2020 1:50 pm

richmond62 wrote:
Sat Oct 24, 2020 1:48 pm
... but to dim the surroundings, presumably, involves large PNG
images with a semi-transparent section.
Or just use an opaque (grey/black?) graphic with its blendlevel set. 8)

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: custom 'widgets'

Post by stam » Sat Oct 24, 2020 1:52 pm

The dimming in the image (courtesy of apple dev website) is for illustration purposes, to hilite the popover, invariably popovers do not dim the parent window.
Basically i just want to prepare the shape in the IDE for convenience (it's easy to do in code but i'm lazy... :) )

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”