The blend level of a stack...

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

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

The blend level of a stack...

Post by bogs » Thu Aug 01, 2019 10:00 pm

I was playing with blendLevel today, and noticed that when you set the stack to a blendLevel, it automatically applies to all the objects in that stack (which I should have probably known).

My question is, is it possible to have a stack blendLevel of say, 100, but set an object to still show?
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: The blend level of a stack...

Post by FourthWorld » Thu Aug 01, 2019 10:07 pm

If you're looking for transparency, see the windowShape property, using a masked PNG.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: The blend level of a stack...

Post by bogs » Thu Aug 01, 2019 10:45 pm

Oh, I already know about creating a window shape from a picture, and I already further know that you can say, drop some controls, set the bottom to srcClear, and then drop the decorations and have it show just like the windowShape, for example -
Image

What I would like to know is if there is a way to have the stacks blending set to 100 (clear), and have controls that still show up.

Removing decorations is workable, and I can code the moving of the stack just fine (thanks to Ben Beaumont's useful article).

However, if you say, turn decorations off, the stack immediately goes to the center of the screen. Same if you turn them back on again (not sure why that happens either, pretty sure I read about it somewhere but have forgotten).

I don't necessarily want to ditch the decorations, just make it fade in and out. If you see what I mean. Without affecting objects on the card.
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: The blend level of a stack...

Post by FourthWorld » Thu Aug 01, 2019 11:52 pm

The window is recreated from OS routines when decorations are toggled, hence the reinitialization.

I don't know a way around that which would also support a dissolve effect.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: The blend level of a stack...

Post by [-hh] » Fri Aug 02, 2019 11:28 am

bogs wrote:What I would like to know is if there is a way to have the stacks blending set to 100 (clear), and have controls that still show up.
No, that's contradictory as controls are part of the stack.

What you want is probably to have a transparent background for some controls (the titlebar is not a control). This is, as FourthWorld and yourself wrote, easily achievable with windowshape.

In order to have a fading titlebar (window controls) you could use the technique from the sample stack "Yosemite Style Window Creator" ( http://livecodeshare.runrev.com/stack/791/ by Rolf & Bernd) and then fade the fake "titlebar" in/out.
shiftLock happens

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: The blend level of a stack...

Post by bogs » Fri Aug 02, 2019 12:43 pm

FourthWorld wrote:
Thu Aug 01, 2019 11:52 pm
The window is recreated from OS routines when decorations are toggled, hence the reinitialization.
Alright, that sounds like what I remember reading (I really need to keep better track of these things when I come across them :? ) and it makes sense.

I tried a number of methods of storing the location of the stack prior to the code removing decorations, so that after the window re-initialized it would (I thought) go to the last location it was at while the decorations were showing, but apparently I am still lacking somewhere and couldn't get it to go.

I guess I'll have to keep trying along that tack, though, until I figure it out.
This is, as FourthWorld and yourself wrote, easily achievable with windowshape.
I really am not looking for windowShape, nor to fake the decorations blending (I guess I may have to use some fakery in this though I'll try not to), but thanks for pointing out that stack -hh, I'll make sure to take a look at it.

Just removing decorations doesn't require windowShape (that picture 2 posts up doesn't use it), and I created an animated stack that didn't use it either (but does use Ben's routine to move it around). Creating the transparent background for controls is easier than I would have thought, and doesn't actually require using anything outside of Lc objects.
Image
I found it funny while looking for clues to this that they had split Ben's article into 2 segments from the original, the first displaying creating a windowShape, and the second displaying (more or less) the code for moving the window after the shape was applied. The original article was a nice 1 shot explanation :roll:
Image

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: The blend level of a stack...

Post by [-hh] » Fri Aug 02, 2019 2:17 pm

The most important thing is that, at the end of the thread, you know what you want ;-)
shiftLock happens

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: The blend level of a stack...

Post by bogs » Fri Aug 02, 2019 3:17 pm

[-hh] wrote:
Fri Aug 02, 2019 2:17 pm
The most important thing is that, at the end of the thread, you know what you want ;-)
Yes, figuring out how to get to it is a little irritating though :D
[-hh] wrote:
Fri Aug 02, 2019 11:28 am
bogs wrote:
What I would like to know is if there is a way to have the stacks blending set to 100 (clear), and have controls that still show up.
No, that's contradictory as controls are part of the stack.
I suppose the reason I thought I was just missing something is that I was thinking of the blending of the stack like the text settings for it.

You know, when you put a control on the card, unless you change the text setting for that control, it inherits the text of the stack. Of course, you can then set the text format of the control to anything you want. I had been thinking it worked that way for all the settings for some reason.

Now I wonder why it doesn't :twisted: (I'm such a stinker) :twisted:
Image

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: The blend level of a stack...

Post by bogs » Fri Aug 02, 2019 9:53 pm

Ok, I think I found a workable solution using a bit of 'fakery' (thanks for that hint -hh!) by using 2 stacks.

It goes something like this -
- I turn the decorations off on the main stack
- the substack has decorations
- when the mouseEnter message for the graphic is sent, the substack is made visible
- I set the topLeft of the substack to the topLeft of the main stack, effectively making it an overlay
- I use the moveStack handler to keep them synced up

Now, all of the above works perfectly, no issues. The problem comes in when I am finished moving the stack, and want to hide it again. I can't seem to figure out what message is sent when moveStack finishes?

None of the usual suspects seem to work, mouseUp, mouseLeave, etc if you exit the title bar from an upward direction. mouseLeave *does* work if you move the mouse down through the card area, but you can hardly expect an end user to do that with any regularity :wink:

So, how do you detect when a user has stopped dragging a stack somewhere? Is it 'resumeStack'?
Image

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: The blend level of a stack...

Post by bogs » Sun Aug 04, 2019 4:59 pm

Ok, This is more or less the effect I was shooting for with the original question, you can see (maybe) why windowShape would not have worked for this.
Image
However, reaching this point brings up more questions that I couldn't figure out the answer to.
For instance, 'rect' as it applies to stacks vs. objects.

If i 'put the rect of button 1', it returns the outside dimensions of the button, as I would expect it too. However, if I 'put the rect of this stack', it appears to return the dimensions of the card area inside the stack? Is this a bug, or is rect supposed to act in this fashion? It presents some problems in cases where you are trying to determine if the mouse is or is not within the rect of the stack if it does not include the titlebar / side frames / etc.
bogs wrote:
Fri Aug 02, 2019 9:53 pm
So, how do you detect when a user has stopped dragging a stack somewhere? Is it 'resumeStack'?
resumeStack *does* kind of work, however it doesn't appear as reliable as I would like, is there a suggestion for a better method of detecting when the mouse is released from the titlebar? I couldn't seem to find anything that suggested itself.

If there is no better suggestion, is there a way to determine when the window has lost focus? I couldn't find that either :?

Depending on the answers (or lack thereof) I may have more questions to follow :P
Image

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: The blend level of a stack...

Post by [-hh] » Sun Aug 04, 2019 6:55 pm

(1)
Possibly you are simply documenting an old bug (some may call it feature) which is on linux only: That is to have a partially transparent stack window.
Here another possibility to have transparent parts ("holes") in the stack window using the ink, once again on linux only: https://quality.livecode.com/show_bug.cgi?id=19700

I doubt your demo runs on non-linux platforms.

(2)
the rect of a stack --> global coords (relative to screen)
the rect of a control --> local coords (relative to stack window)

(3)
how do you detect when a user has stopped dragging a stack somewhere? Is it 'resumeStack'?
You could use moveStack or mouseEnter (the card gets mouseEnter or a control that hides the card window below the titlebar).
When you use an own drag routine (window without titlebar) you know it anyway.
shiftLock happens

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: The blend level of a stack...

Post by bogs » Sun Aug 04, 2019 9:49 pm

[-hh] wrote:
Sun Aug 04, 2019 6:55 pm
(1)
Possibly you are simply documenting an old bug (some may call it feature) which is on linux only: That is to have a partially transparent stack window.
Here another possibility to have transparent parts ("holes") in the stack window using the ink, once again on linux only: https://quality.livecode.com/show_bug.cgi?id=19700

I doubt your demo runs on non-linux platforms.
Huh, I didn't know that existed, but no, that isn't what is going on, and what I did should be able to be duplicated on any platform. Here it is running on Win 7, for instance, in Lc 9.5 stable...
Image

Maybe the description of what I was doing 2 posts up wasn't clear enough, if that is the case, forgive me.

To lift the curtains, so to speak, here is the stack I am experimenting with. I will warn you right now, it is both rough and ugly, and the fading out is more for show than any real necessity (although I think it looks better than just blinking on and off).

I really am still working out the bugs. Should be able to run at least back to 6.5.x., and while I couldn't test it on Mac, it worked elsewhere.
stackMoving.livecode.zip
A stack, substack, and some "fakery"....
(970 Bytes) Downloaded 142 times
(2)
the rect of a stack --> global coords (relative to screen)
the rect of a control --> local coords (relative to stack window)
Yes, but I don't think I made what I meant clear there either. Maybe these 2 pictures will make it a little better to understand -
This is where the topLeft of the stack places the cursor...
Screenrect1.png
TopLeft of stack ....
But this is where I would expect to see the topLeft of the stack...
screenRect2.png
Where I would expect TopLeft of stack...
[-hh] wrote:
Sun Aug 04, 2019 6:55 pm
You could use moveStack or mouseEnter (the card gets mouseEnter or a control that hides the card window below the titlebar).
Hm. I am using 'moveStack' in fact to line the 2 stacks up, how would I use it to trigger the fade out? I tried a few ways, but couldn't figure out how to tell when moving the stack actually ended? I am in fact currently tying the fading in and out to mouseEnter and mouseLeave, but the problem is of course you have to enter and leave through the card area, and an end user may wind up going straight up from the title bar, if you see what I mean.
Image

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: The blend level of a stack...

Post by [-hh] » Sun Aug 04, 2019 10:21 pm

(1)
For the rect including the decorations use the effective rect of this stack (LC 6/7/8/9)
(2)
Your stack sadly doesn't work as intended on Mac here. I'll look into it tomorrow.
(3)
... how to tell when moving the stack actually ended
For example:

Code: Select all

on movestack h,v
   -- ... your code here
   send "movedone" to me in 0.5 seconds -- time may need adjustment
end movestack

on movedone
   if the mouse is up then put "movedone"
end movedone
shiftLock happens

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

Re: The blend level of a stack...

Post by SparkOut » Sun Aug 04, 2019 10:34 pm

Er, apart from the Window decorations fading in and out, can I ask what is expected here?
As far as I can see, the background graphic "Round Rectangle" is always visible. I can't see any partial transparency of the stack. Is this what you're expecting? I got the impression you were suggesting we could have a floating button without any other stack controls? I see the black background graphic all the time (Win 10).
(The behaviour I see is what I would expect, this is why I was intrigued to see if you had got something magic going on)

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: The blend level of a stack...

Post by bogs » Sun Aug 04, 2019 10:43 pm

AAAAAAAHHHHHHHHHhhhhhhhhhhhhhh !! (x 2)

Thanks -hh! I'll take a look at it on OSX myself, I'd really be surprised if it didn't work there for some reason, after all, it is just one stack moving another :roll:

@ SparkOut -- hmmmm.... Maybe what -hh said before is right after all, It didn't occur to me to check it by floating it over something else, when it looked like it was showing the desktop like it does on 'nix. I'll have to take a look at it tomorrow, when I have more time.

I'll apologize to -hh in advance, since I may have jumped the gun there, I guess it *may* be what you said after all :oops:
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”