Help re: flushebents, kill and systemwindow

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Christina Lipscomb
Posts: 4
Joined: Wed Apr 12, 2006 3:15 pm
Location: Australia

Help re: flushebents, kill and systemwindow

Post by Christina Lipscomb » Wed Apr 12, 2006 3:38 pm

Hi,

I am fairly new to revolution and need some help to ensure an application loaded via the shell is always the top window, even if the user clicks on another window. I have searched the list and looked through the rev docs but can't find a solution which will work on all platforms.

The specific issue is....

I have an application which acts as a main menu (containing buttons) to load other applications I have made with rev. When I click on a button an application is loaded via the shell function and the do command. Howver, the application that is being loaded takes a couple of seconds to load. If I click on the main menu window (application) while the other application is loading the new application window will load behind the menu. The menu and the other applications do not have a title bar or controls (eg. minimize).

Is there a way to work around this?

I have tried putting flushevents("mousedown") as well as mouseup, system and activate in the handler. I have also tried to set the menu's systemwindow property to false if the user clicks on it while a linked application is loading. I tried to set the linked application's systemwindow to true once it is loaded - the application comes to the front for a split second then disappears behind the menu. I have tried to use the
click command to activate the new application as soon as it is loaded. Last, I have tried to use the kill command (when the menu is closed) to close the applications I know may have been loaded but are sitting behind the menu's window. I must not have been using this correctly as it didn't work. Can the kill command really close an application if the process image name is known? I have tried to use all of the above with the launch command as well.

Any help would be greatly appreciated.

Thanks,

Christina

mcgrath3
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 149
Joined: Thu Feb 23, 2006 8:49 pm
Location: Bethel Park, Pittsbrugh, Pennsylvania USA
Contact:

Post by mcgrath3 » Thu May 04, 2006 8:00 pm

Hi,

Can you break this problem down or do you have a sample stack to track it?

Do you use RevOnline?

Tom
Tom McGrath III
Lazy River Software
3mcgrath@comcast.net

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Help re: flushebents, kill and systemwindow

Post by Mark » Thu May 04, 2006 9:40 pm

Hi Christina,

With so little information, it is really difficult to come up with a good reply.

Why don't you use the launch command or, if the menu is a Revolution application, why don't you build just one standalone that includes all applications?

On which are you trying to use the shell? I guess it is Mac OS X, since you are trying to use the kill command (while 2.7.1 is not available for Linux yet and being a new user you probably have 2.7 or later?).

Are the applications you made normal standalones, or did you take the executable out of the application package, since you're launching them from the shell?

Can't you just hide the menu until the application that was launched quits? Something like

hide me
get shell() -- add commands to launch app
show me

might work.

Why is it a problem that the menu appears in front of the application that is being launched?

To answer you question about the kill command, it really kills an application, it does not shut it down properly. I believe you will need to know the process id to kill a running application. So, you really need to know that the application is running to 'kill'.

Generally, I think you need to re-think your approach. Using the shell like this is really not necessary. I recommend making one application, possibly with a number of stack files. Your menu really asks for a "splash" style standalone. If you really feel you need a separate menu app, you could let it launch other applications, then let it quit and launch it again when one of the sattelite applications quits. Make sure to launch and quit correctly, don't use the kill command for that.

Best and good luck,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Christina Lipscomb
Posts: 4
Joined: Wed Apr 12, 2006 3:15 pm
Location: Australia

Post by Christina Lipscomb » Thu May 18, 2006 8:51 pm

[img]Hi Tom and Mark,

Sorry I haven't posted a reply until now. I appreciate the time you took and the effort made. I had given up on receiving a reply to my question as I had submitted it to the list a month or so ago and it didn't even get approved. I guess the people at RunRev were busy setting up this forum. After posting on the forum and receiving no reply initially, I stopped checking my email account where notifications are sent.

I ended up working it out using the following in the card script of the menu


global gclick

on mouseup
if gclick = 1 then
then set the systemwindow of this stack to false
end if
end mouseup


The variable gclick is set to 1 when a menu item is selected and 0 when the specific linked application has opened. If the user clicks on the menu card while an app is loading, there is a slight screen flicker however, the new app loads in front.... not perfect but it will do. Previously, the user would not see the launched app if they had clicked on the menu app while the second app was loading. My menu is a full screen app.

The reason I chose to not include all the applications in a single standalone is because the menu is linked to over 80 different applications, which are heavily loaded with images, animations and sounds. At first I tried using the launch command but my menu application would crash on Windows. The shell hasn't caused me any problems as yet.

Last, thanks for the information about ‘kill’.

Thanks again, I promise I won’t be so tardy in future…..don’t want a bad reputation or anything :-)
[/img]

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu May 18, 2006 9:10 pm

Hi Christina,

Take your time, nobody expects an instant reply. Right? ;-)

I still don't understand somthing. If those other 80 apps are made with Revolution, why don't you just open them as a stack, within your menu app?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Christina Lipscomb
Posts: 4
Joined: Wed Apr 12, 2006 3:15 pm
Location: Australia

Post by Christina Lipscomb » Mon May 22, 2006 7:05 pm

Hi Mark,

Thanks for your reply. Will still aim to be prompt....I have standalones so that my apps are copy protected. I use PCGuard to protect my Windows executables.

Currently I'm donating my software to universities and want to try to ensure it is not used outside them. I know you can lock to the Mac Address on Macs and the HD serial on PCs via revolution, but I don't trust myself re: creating an activation system around this. I think I'll leave the key generation etc algorithms to the professionals :-)

Thanks for your support.

Christina

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon May 22, 2006 8:41 pm

Hi Christina,

A common approach is to have a library with most of the scripts of the project, while the other stacks call the handlers in that library. The library is often attached to the standalone, though not always.

Your sattelite applications could all use the scripts in a library, which is part of the standalone. When you open the standalone, it should start using that library. That would make it impossible to run the sattelite applications without the standalone and the standalone would need a license key to run. That should sufficiently secure your software and allows you to have just one standalone with a menu. Additionally, you can protect the stacks with a password.

Two more remarks: first, you don't need to be very suspicious about people stealing your stacks and, second, if people really want to, they will always find a way to hack your work. Providing a challenge only attracks more hackers.

I still think that having one standalone with a menu window and a number of stacks that are opened by the standalone is the right approach for you. You could still use PCGuard for the executable which includes the library.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Christina Lipscomb
Posts: 4
Joined: Wed Apr 12, 2006 3:15 pm
Location: Australia

Thanks for the direction

Post by Christina Lipscomb » Fri Jun 02, 2006 4:57 pm

Hi Mark,

If only I have chatted to you seven months ago. The approach you recommend would have reduced the size of the software by about 100 MB. I will definitely use such an approach in the future. I think I need to do a programming course :-)

Cheers,

Christina

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Jun 02, 2006 6:37 pm

Well, instead of doing an expensive course, you can always ask here, before you start a new project. Btw, there are also several professional consultants around, as you can see on the runrev.com web site ;-) Good luck with the release of your software!

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”