Bringing Separate Livecode apps on Top via launcher

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

Bringing Separate Livecode apps on Top via launcher

Postby Lagi Pittas » Fri Jul 14, 2017 5:08 pm

Hi

I have a program that can use different data , graphics, etc nad I want 1 version to run in 3 different configurations.

So I have copied the whole directory 3 times renamed the application differently and setup the config and data files graphics etc to be different for each directory.

I created a little launcher program with 3 buttons that have a button like

Code: Select all
on mouseUp
    launch "C:\Users\xxxx\Documents\multi\nameXXX\progxxx.exe"
end mouseUp


Fine and dandy - it worked first time - I should hope so!!

I already had a on relaunch handler in the main stack that just beeped to stopp people running multiple copies of the original.

My problem is if I set systemwindow to true on relaunch you would expect the window to come to the top but it doesn't. The first time each application is run it does show at the top but pressing the launcher with

set the systemwindow of me to true


has no effect.

I can think of a "simple" way but I woulkd like to do it the obvious way.

The simple way is putting "the launcheR button in the app - but that means a lot of real estate movement.

Here is how I used to do it in Foxpro - if anybody can show me how to "wrap" this with infinite livecode on windows with a C interface i then have a good reason to make a move to version 8 - at least for the launcher which will be three times the size of the main app - go figure.

LOCAL lcWinName, lnHWnd

lcWinName = "Your window title name"
DECLARE INTEGER BringWindowToTop IN WIN32API LONG HWND

DECLARE INTEGER ShowWindow IN WIN32API LONG HWND, LONG nCmdShow

DECLARE INTEGER FindWindow IN WIN32API STRING, STRING

lnHWnd = FindWindow(0, m.lcWinName)
IF m.lnHWnd <> 0
ShowWindow(m.lnHWnd, SW_RESTORE)
BringWindowToTop(m.lnHWnd)
ENDIF


edit

to further explain - we could call these routine like this

BringWindowToTop(tnHWND)
ShowWindow(m.lnHWND, 3)

and there were other calls we could "bind" like

DECLARE INTEGER GetForegroundWindow IN user32 - so you could see which window was in the foreground . - simples.

Any help/ideas/cake welcome.

KIndest Regards Lagi
Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 228
Joined: Mon Jun 10, 2013 1:32 pm

Re: Bringing Separate Livecode apps on Top via launcher

Postby Klaus » Fri Jul 14, 2017 6:02 pm

Hi Lagin,

I found that sometimes "... of me" does not work reliably when ME is referring to a stack, try with:
Code: Select all
set the systemwindow of stack "name of the stack here" to TRUE

And since LC and "do XYZ as VBSCRIPT" on Windows, I am sure there are lots of VB code snippets around on the internet
that will bring an EXE to front.


Best

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

Re: Bringing Separate Livecode apps on Top via launcher

Postby bogs » Fri Jul 14, 2017 8:54 pm

Klaus wrote:<sic>...
I found that sometimes "... of me" does not work reliably when ME is referring to a stack, try with:
Code: Select all
set the systemwindow of stack "name of the stack here" to TRUE


Curious, does "this stack" work more reliably than "of me"? Or is it always better to use the "stack "name of the stack" ?
Code: Select all
set the systemWindow of this stack to true
or
Code: Select all
set the system window of stack "mySuperStack" to true
I would suspect the 2nd (referring by specific name) is the better solution, right?
"...many commentators have thrown much darkness on this subject, if they continue we'll soon know nothing at all about it." ~ Mark Twain
bogs
 
Posts: 178
Joined: Sat Feb 25, 2017 10:45 pm

Re: Bringing Separate Livecode apps on Top via launcher

Postby FourthWorld » Fri Jul 14, 2017 9:33 pm

I've found that on some OSes it's necessary to set the style of the stack to palette in addition to setting the systemWindow to true, if you want it above other apps' windows.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 5234
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles

Re: Bringing Separate Livecode apps on Top via launcher

Postby Lagi Pittas » Fri Jul 14, 2017 9:43 pm

I Tried that - No Cigar.

I thought this is what widgets were invented for - I wanted tio stay clear of any other Exes be they VB or delphi.

I will see how slow a shellexecute with a small delphi program will be instead of getting all messy with VB.

Regards Lagi

p.s. still wish Ali ir Mark would come to the rescue with a short course in calling from LCB. :D
Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 228
Joined: Mon Jun 10, 2013 1:32 pm

Re: Bringing Separate Livecode apps on Top via launcher

Postby FourthWorld » Fri Jul 14, 2017 10:51 pm

You might consider filing a bug report on this.

Though FWIW I just tested on my Win10 box and systemWindow seems to be working well with the latest v9 build.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 5234
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles

Re: Bringing Separate Livecode apps on Top via launcher

Postby Lagi Pittas » Mon Jul 17, 2017 10:32 am

Hi Richard

I'm going to install 9 and see what happens

Thanks again

Lagi
Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 228
Joined: Mon Jun 10, 2013 1:32 pm


Return to Getting Started with LiveCode - Experienced Developers

Who is online

Users browsing this forum: No registered users and 3 guests