Create a button's icon with a part of a big image? - Beleaguered Castle

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: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Create a button's icon with a part of a big image?

Post by stam » Sat Aug 20, 2022 11:46 am

Ah, too bad - but at least you have a working solution thanks to Richmond's advice...

Maybe others will find Vectornator useful - having used this for a little while i'm quite impressed and not in the least given the price point...

My go-to vector app has been Affinity Designer (https://affinity.serif.com/en-gb/designer/) - very good app but not cheap (i don't mind paying to support smaller software companies if their product is good, and this is very good).

But I must say, Vectornator gives Designer a run for its money - and its completely free, as is it's iOS counterpart.

S.

Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Re: Create a button's icon with a part of a big image?

Post by Zax » Mon Aug 22, 2022 12:01 pm

I'm now almost at the end of the project but I encounter a problem with the standalone version.

The standalone works fine on Mac but but the app does not launch on Windows 10. Nothing happen, no error message but the app's name appears in the "Process" tab of Window Task Manager. Each time I double-click on the app's icon, a new process is created... but absolutely nothing appears on the screen.

I built a standalone for Windows a few days ago and it worked fine.
I recently re-built the app menu with the Menu Builder: could the menus be the cause of this problem?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10092
Joined: Fri Feb 19, 2010 10:17 am

Re: Create a button's icon with a part of a big image?

Post by richmond62 » Mon Aug 22, 2022 12:11 pm

Did you choose a Windows 32-bit or 64-bit build?

Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Re: Create a button's icon with a part of a big image?

Post by Zax » Mon Aug 22, 2022 12:40 pm

richmond62 wrote:
Mon Aug 22, 2022 12:11 pm
Did you choose a Windows 32-bit or 64-bit build?
I tested both with the same result.
Of course, I also checked the inclusions and they seem to be OK.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10092
Joined: Fri Feb 19, 2010 10:17 am

Re: Create a button's icon with a part of a big image?

Post by richmond62 » Mon Aug 22, 2022 4:26 pm

Make a new stack, put a single button on it, save it, then build standalones and test them.

If they work it is your game, if they don't work it is time to delete LC and all its preference files, caches and so on, then reinstall LC.

Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Re: Create a button's icon with a part of a big image?

Post by Zax » Mon Aug 22, 2022 4:44 pm

richmond62 wrote:
Mon Aug 22, 2022 4:26 pm
Make a new stack, put a single button on it, save it, then build standalones and test them.

If they work it is your game, if they don't work it is time to delete LC and all its preference files, caches and so on, then reinstall LC.
Done.
The "empty" Windows standalone works like a charm... I don't know I have to be happy of not :(
I wonder which part of my code can cause a launch failure on Windows without any error message. I inserted lots of try-catch in the stack opening handlers but I believe the standalone doesn't reach the preOpenStack handler. I believe it fails silently when the standalone LC engine is launched.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Create a button's icon with a part of a big image?

Post by jacque » Mon Aug 22, 2022 5:33 pm

This sounds a bit like the printer driver bug. Does your app support printing?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Re: Create a button's icon with a part of a big image?

Post by Zax » Mon Aug 22, 2022 5:47 pm

jacque wrote:
Mon Aug 22, 2022 5:33 pm
This sounds a bit like the printer driver bug. Does your app support printing?
No, there is no print functions in my app but I was wrong: it's not a standalone problem: the stack (standalone) is well launched but its windows is just not visible. When it occurs on Mac, we still have the standalone menu bar but not on Windows.

I'm looking deeper in my code but I think my bug is just a "standard" mistake and not a weird standalone problem. I'll keep you informed.

Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Re: Create a button's icon with a part of a big image?

Post by Zax » Mon Aug 22, 2022 6:08 pm

Problem solved: it appears that loading the substack that contains all the SVGs takes some times, so I had to add a send <message> in 30 to wait during the loading procedure.

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Create a button's icon with a part of a big image?

Post by stam » Mon Aug 22, 2022 6:57 pm

Not sure what your setup is but it's often useful to use a 'splash stack' - a minimal stack with very little code that shows first, then launches the mainstack.

Basically the 'app' is the splash stack built as a standalone which then calls the main stack after app launch - you could have a visual cue such as the spinner widget running so the end user knows the app is running and then dismiss the splash stack when your mainstack (and it's svg substack) is loaded. Or some such ;)

Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Re: Create a button's icon with a part of a big image?

Post by Zax » Tue Aug 23, 2022 6:20 am

You are right stam, I will do that. However, the real problem persists: how to know when all the resources of the substacks have been loaded?

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Create a button's icon with a part of a big image?

Post by stam » Tue Aug 23, 2022 8:43 am

Depends - do u actively load resources? (Eg assign the image data to a control) or do you mean it’s a passive process?
If it’s the former just start your code with “show widget “spinner”, assuming you’ve added a spinner widget and set it’s visible to false, and end the code block with “hide widget spinner”. Or if there is a defined number of images you’re doing this to you could use a progress bar.

If you mean it’s just a passive process I guess you could fake it and just display a spinner or progress bar for a suitable period. On the other hand if passively loading resources is delaying your stack from showing up you could periodically check for visibility of the main stack. Or you could take advantage of the “after <handler>“ structure. Eg add a “after openstack / end openstack” handler in the main stack to dismiss the splash stack.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4170
Joined: Sun Jan 07, 2007 9:12 pm

Re: Create a button's icon with a part of a big image?

Post by bn » Tue Aug 23, 2022 9:01 am

stam wrote:
Tue Aug 23, 2022 8:43 am
Or you could take advantage of the “after <handler>“ structure. Eg add a “after openstack / end openstack” handler in the main stack to dismiss the splash stack.
Isn't "after handler" and "before handler" only available in behaviors?

Kind regards
Bernd

Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Re: Create a button's icon with a part of a big image?

Post by Zax » Tue Aug 23, 2022 9:05 am

I didn't know the after handler, but it seems dedicated to behavior.

My problem is I don't know precisely why or when my problem occurs. All I can say is when I delay some processes with send ... in some ticks, it works, specially with a standalone.

This is the basic structure I always use:

Code: Select all

on preOpenStack
   hide me // place later the stack according to user prefs file
   insert the script of stack (MyMainSubstack) into back // contains some scripts and icons
   start using stack "BCAGlobalNetStack" // personal TSNet stack
   put ("standalone" is in the environment) into appAlone
   repeat for each line thisLine in (the substacks of me)
      set cantAbort of stack thisLine to appAlone
   end repeat
   set cantAbort of me to appAlone
   if (not appAlone) then choose Browse Tool
   set navigationArrows to false
   
   initConstantes // init some variables and default settings
   send "prefsRead" to me in 3 // user prefs file
   send "saveGameRead" to me in 5 // savedgame file
   
   opening
end preOpenStack

on opening // effets
   prefsStackApply // apply user prefs, previously read from prefs file, including stack dimensions and location
   dispatch "openingCard" to card "Main" // "openCard" sens to early to the card "Main" !!!
   /*
   openingCard in card "Main" : apply all SVGs to all cards game, eventually by looking in a substack containing all SVGs of different card sets
   */
   send "showMe" to me in 30 // -------------------- ?????????
   // TEST IF ALL IS LOADED AND OK TO SHOW THE MAIN STACK ????
end opening

on showMe
   show me
end showMe

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Create a button's icon with a part of a big image?

Post by stam » Tue Aug 23, 2022 8:46 pm

bn wrote:
Tue Aug 23, 2022 9:01 am
stam wrote:
Tue Aug 23, 2022 8:43 am
Or you could take advantage of the “after <handler>“ structure. Eg add a “after openstack / end openstack” handler in the main stack to dismiss the splash stack.
Isn't "after handler" and "before handler" only available in behaviors?

Kind regards
Bernd
I stand corrected - i am currently heavily into using behaviours for cards and stacks for such things and my mind slipped ;)

Post Reply