start a program minimized

Started by Stefan S., November 19, 2008, 09:35:58 AM

Previous topic - Next topic

Stefan S.

Hello,

program A starts another program B with fglrun. Now I want to set program A in the foreground. Is that possible ?
I want to start Program B always minimized.  There is an windowstate for "maximized", but not for minimized ?

Any idea


Thanks
Stefan Serwe

Lionel F.

Hello Stefan,

For now, windowState style attribute can only be set to values "normal" or "maximized", not to "minimized"
It has not been implemented because, until then, we did not find any obvious interest to start an application in minimized state.

What is exactly the aim of your program supposed to start in background/minimized ? Maybe we could help you to find a nearing solution.  Thank you for precising.

Best regards,
Lionel



Stefan S.

Program B starts every 20 Second to Import Data from a sps connected to that local PC.
So it is not necessary to see Program B at start-up.

Quote from: Lionel Fluck on November 21, 2008, 11:08:57 AM
Hello Stefan,

For now, windowState style attribute can only be set to values "normal" or "maximized", not to "minimized"
It has not been implemented because, until then, we did not find any obvious interest to start an application in minimized state.

What is exactly the aim of your program supposed to start in background/minimized ? Maybe we could help you to find a nearing solution.  Thank you for precising.

Best regards,
Lionel




Lionel F.

Hello Stefan,

For now, I'm afraid there is no way to do this. This is nevertheless the object of a feature request already referenced in our database :
fz.#2335 => Be able to choose the way a window gets open (Minimized, Maximized,Default)

I added your name to the list of requesters. There is currently no date planned for implementation mainly due to other priorities, especially the version 2.20. However, it has been taken into account, and the development team will evaluate the opportunity of implementing this in the future.
Thanks for the suggestion,

Best regards,
Lionel

Lionel F.

Hello Stefan,

I get back to you regarding this. Would a style attribute which allows to start an application "minimized (e.g. windowState = minimized) be sufficient to do what you're expecting?

Or, do you need a way to change the window state directly in the 4GL code (for instance, using a function) ?

Any other comments or impressions on this are also welcome...

Stefan S.

for my aim it will be enough to have a style attribute to start an applivation mimimized

Stefan S.

is there a possibility to set the focus to program a when program b is running ?
Perhaps something with dom-note manipulation ?


Reuben B.

If you are using Windows you can use appActivate via a front-call to set the focus to a particular window, see attached example.

It would probably also be possible to open a window minimized using a similar technique and sendKeys

Code (genero) Select
MAIN
DEFINE ch base.Channel

   CLOSE WINDOW SCREEN
   IF base.Application.getArgumentCount() = 0 THEN
      -- start 3 programs and send a vbs script to the client
      LET ch = base.Channel.create()
      CALL ch.openFile("appActivate.vbs","w")
         
      CALL ch.writeLine('strWindowTitle = WScript.Arguments(0)')
      CALL ch.writeLine('set WshShell = WScript.CreateObject("WScript.Shell")')
      CALL ch.writeLine('WshShell.AppActivate strWindowTitle')

      CALL ch.close()
      CALL FGL_PUTFILE("appActivate.vbs","appActivate.vbs")
   
      RUN "fglrun appActivate aaa" WITHOUT WAITING
      RUN "fglrun appActivate bbb" WITHOUT WAITING
      RUN "fglrun appActivate ccc" WITHOUT WAITING
   ELSE
      -- open program that has 3 buttons that call vbscript to change the window/program with focus
      OPEN WINDOW w WITH FORM "appActivate"  ATTRIBUTES(TEXT=base.Application.getargument(1))
     
      MENU ""
         ON ACTION aaa
            CALL appactivate("aaa")
         ON ACTION bbb
            CALL appactivate("bbb")
         ON ACTION ccc
            CALL appactivate("ccc")
         ON ACTION calculator
            -- Calculator has to be running
            CALL appactivate("Calculator")
         ON ACTION close
            EXIT MENU
      END MENU
   END IF
END MAIN

FUNCTION appactivate(window)
DEFINE window STRING
DEFINE command STRING
DEFINE result INTEGER

   LET command = SFMT("appActivate.vbs %1", window)
   CALL ui.Interface.FrontCall("standard","shellexec",command,result)
END FUNCTION



Code (per) Select
LAYOUT (MINHEIGHT=15)
GRID
{
Click on button to make window active
}
END
END
Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero

Stefan S.

thanks,
I can use thte vbs-script on the local PC to activate my Window.
Is there a possibility to activate/maximize a program with wsh if it is minimized ?