KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

How to hide a form while external app. has focus !

 
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting
View previous topic :: View next topic  
Author Message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Tue Mar 06, 2007 5:15 pm    Post subject: How to hide a form while external app. has focus ! Reply with quote

My code at the moment hides the mainform while the external application is running.
I am trying to find a way of modifying this such that it only hides while the application has focus. If I say minimise the application I want the main form to re-appear to allow me to 'shell' run a further instance of the original application or an alternative application. (It's a Menu System.) Question

Code:

FUNCTION RUNIT($cmd)
  $mainform.hide
  ;lots of other bits...
   SHELL $cmd
  $mainform.show
ENDFUNCTION


Anyone know a good approach ?
I have also been trying to figure out how to tell $mainform to minimize rather than hide as a possible alternative but can't see anything in the .chm
________
Buy no2 vaporizer


Last edited by MACE1 on Fri Feb 18, 2011 5:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
Chris S.
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 241

PostPosted: Thu Mar 08, 2007 3:29 am    Post subject: Reply with quote

The only way I can think of doing what you described is to add the AutoIt com component (AutoItX) to your script.
Back to top
View user's profile Send private message MSN Messenger
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Thu Mar 08, 2007 10:53 am    Post subject: Reply with quote

I've had a look at AutoIT. Its good but not really the route I want to go with this. Would have to install on too many PC's.

Anyone know is there a control in kixform.dll to '.minimise' rather than '.hide'
________
HOW TO ROLL BLUNTS


Last edited by MACE1 on Sat Mar 12, 2011 5:33 pm; edited 1 time in total
Back to top
View user's profile Send private message
Chris S.
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 241

PostPosted: Thu Mar 08, 2007 5:03 pm    Post subject: Reply with quote

WindowState Property

Description
Gets or sets the window state of the form.

Syntax
object.WindowState [ = Value ]

Property Value
One of the following values. The default is Normal.

Value Name Description
0 Normal A default sized window
1 Minimized A minimized window
2 Maximized A maximized window


I don't think it will do what you want it to do, however. You're using KiXtart shell to run the other application. The code will pause until the shelled program is no longer running. Your form will not be refreshed when you restore it from the minimized state.

You'll need to switch to KiXforms Shell or KiXtart's Run to allow the code in your KiXforms script to continue.
Back to top
View user's profile Send private message MSN Messenger
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Mon Mar 12, 2007 8:59 am    Post subject: Lave it minimised is the method I have had to employ. Reply with quote

As a system window it always remains in front of everything.
If I just want a regular window, what is the syntax for kixforms?

Code:

$system = CreateObject("Kixtart.System")
   $mainform = $system.form()
   $mainform.caption = "MENU[" + $cnt + "]"
   $mainform.width = $wx + 110
   $mainform.height = $wy + 10
   $mainform.topmost = "true"
   $mainform.maximizebox = "false"
   $mainform.minimizebox = "true"
   $mainform.center
;lots of bits
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FUNCTION doit($cmd)
  $mainform.WindowState=1
   RUN $cmd
ENDFUNCTION

________
OG KUSH


Last edited by MACE1 on Fri Feb 18, 2011 5:09 pm; edited 1 time in total
Back to top
View user's profile Send private message
Chris S.
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 241

PostPosted: Mon Mar 12, 2007 3:51 pm    Post subject: Reply with quote

Stop setting the TopMost property to "true"...

Code:

$system = CreateObject("Kixtart.System")
   $mainform = $system.form()
   $mainform.caption = "MENU[" + $cnt + "]"
   $mainform.width = $wx + 110
   $mainform.height = $wy + 10
   ; $mainform.topmost = "true"
   $mainform.maximizebox = "false"
   $mainform.minimizebox = "true"
   $mainform.center
;lots of bits
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FUNCTION doit($cmd)
  $mainform.WindowState=1
   RUN $cmd
ENDFUNCTION
Back to top
View user's profile Send private message MSN Messenger
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Mon Mar 19, 2007 8:34 am    Post subject: Reply with quote

Wink
Thanks all for that.
It now minimises when the app is called, can be manually restored if wishing to call something else while existing app is running and does not insist it is ALWAYS the topmost window.

M
________
Marijuana vaporizer
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group