I just spent a few hours trying to build a .exe for windows such that
the single window would open at a location defined by the user and saved in a file to be read at startup. Here are the things I tried 1. window moveTo: on startup -- the window of course shows in its old location then jumps. 2. unmap the window before saving -- it gets remapped on startup, so you the jump again 3. minimize the window, move it and then expand it -- of course you cannot move it while minimized 4. close it, save the image, re-open on startup -- you cannot have an image with no window open This seems like a fairly simple thing to want to do!!! Here is what I finally came up with -- any better suggestions would be appreciated: - minimize (collapse) the window just before the final image save - on startup, open a new window - once that window is open, close the minimized window A bit convoluted?? -- Dennis Smith [hidden email] Cherniak Software Development Corporation +1 905.771.7011 400-10 Commerce Valley Dr E Fax: +1 905.771.6288 Thornhill, ON Canada L3T 7N7 http://www.CherniakSoftware.com |
Use RTP and set that window to be the startup window of the app. Have
the window open with a position which is read from a file on startup. The last bit could probably be done easiest by having the window remember its position (UI Painter | Window properties | Position | Advanced | Last/Saved Position), and then changing the value of the stored position (your ApplicationModel's savedWindowInformation class instance variable) on startup by reading from a file. Exit would of course write the position to that file - looks like the value in the civ is updated by closing the window, but not by just resizing it. Look at UIBuilder>>openWithoutHookupFromWindowSpec: for how the info is used, and senders of #savedWindowInformation for how it is written. Steve > -----Original Message----- > From: Dennis Smith [mailto:[hidden email]] > Sent: 29 May 2006 14:33 > To: VWNC, > Subject: Building a .exe for windows with window placement ... > > I just spent a few hours trying to build a .exe for windows such that > the single window would open at a location defined by the user and > saved in a file to be read at startup. > > Here are the things I tried > 1. window moveTo: on startup -- the window of course shows in its > old location then jumps. > 2. unmap the window before saving -- it gets remapped on startup, > you the jump again > 3. minimize the window, move it and then expand it -- of course you > cannot move it while minimized > 4. close it, save the image, re-open on startup -- you cannot have > an image with no window open > This seems like a fairly simple thing to want to do!!! > > Here is what I finally came up with -- any better suggestions would be > appreciated: > - minimize (collapse) the window just before the final image save > - on startup, open a new window > - once that window is open, close the minimized window > > A bit convoluted?? > > -- > Dennis Smith [hidden email] > Cherniak Software Development Corporation +1 905.771.7011 > 400-10 Commerce Valley Dr E Fax: +1 905.771.6288 > Thornhill, ON Canada L3T 7N7 http://www.CherniakSoftware.com |
Steven Kelly wrote: I was avoiding RTP, since this is just a simple little standalone app I was going to give to a few friends,Use RTP and set that window to be the startup window of the app. Have the window open with a position which is read from a file on startup. but it might be good to play with RTP just to see what it does. The last bit could probably be done easiest by having the window remember its position (UI Painter | Window properties | Position | Advanced | Last/Saved Position), and then changing the value of the stored position (your ApplicationModel's savedWindowInformation class instance variable) on startup by reading from a file. Exit would of course write the position to that file - looks like the value in the civ is updated by closing the window, but not by just resizing it. Look at UIBuilder>>openWithoutHookupFromWindowSpec: for how the info is used, and senders of #savedWindowInformation for how it is written. Steve-----Original Message----- From: Dennis Smith [[hidden email]] Sent: 29 May 2006 14:33 To: VWNC, Subject: Building a .exe for windows with window placement ... I just spent a few hours trying to build a .exe for windows such that the single window would open at a location defined by the user and saved in a file to be read at startup. Here are the things I tried 1. window moveTo: on startup -- the window of course shows in its old location then jumps. 2. unmap the window before saving -- it gets remapped on startup,soyou the jump again 3. minimize the window, move it and then expand it -- of courseyoucannot move it while minimized 4. close it, save the image, re-open on startup -- you cannot have an image with no window open This seems like a fairly simple thing to want to do!!! Here is what I finally came up with -- any better suggestions would be appreciated: - minimize (collapse) the window just before the final image save - on startup, open a new window - once that window is open, close the minimized window A bit convoluted?? -- Dennis Smith [hidden email] Cherniak Software Development Corporation +1 905.771.7011 400-10 Commerce Valley Dr E Fax: +1 905.771.6288 Thornhill, ON Canada L3T 7N7 http://www.CherniakSoftware.com -- Dennis Smith [hidden email] Cherniak Software Development Corporation +1 905.771.7011 400-10 Commerce Valley Dr E Fax: +1 905.771.6288 Thornhill, ON Canada L3T 7N7 http://www.CherniakSoftware.com |
In reply to this post by Dennis smith-4
I would think number four sounds good. You just have to set the noWindowBlock to prevent it from trying to re-open a launcher. And saving the image with no windows will require you to fork off something to close and save, but that's not that complicated. So, e.g.
<get ready, close launcher> WindowManager noWindowBlock: [:x | ]. [MyAppModelWorkspaceOrWhereverIAmDoingThisFrom builder window controller closeAndUnschedule. (Delay forSeconds: 1) wait. "Just let everybody else finish what they might be doing" Snapshot new saveAs: 'theResult' thenQuit: true] forkAt: Processor userBackgroundPriority. To open the window, easiest way would probably be to implement #main in a UserApplication subclass and throw in a DeploymentOptionsSystem current startInRuntime: true. in the above, or a -runtime on the command line. If you don't close the launcher, and use the -runtime on the command line, then you won't get a usable finished product, but your edit/save image/debug loop will be a lot easier while you're debugging. At 07:33 AM 29/05/2006, Dennis Smith wrote: >I just spent a few hours trying to build a .exe for windows such that >the single window would open at a location defined by the user and >saved in a file to be read at startup. > >Here are the things I tried > 1. window moveTo: on startup -- the window of course shows in its old location then jumps. > 2. unmap the window before saving -- it gets remapped on startup, so you the jump again > 3. minimize the window, move it and then expand it -- of course you cannot move it while minimized > 4. close it, save the image, re-open on startup -- you cannot have an image with no window open >This seems like a fairly simple thing to want to do!!! > >Here is what I finally came up with -- any better suggestions would be appreciated: > - minimize (collapse) the window just before the final image save > - on startup, open a new window > - once that window is open, close the minimized window > >A bit convoluted?? > >-- >Dennis Smith [hidden email] >Cherniak Software Development Corporation +1 905.771.7011 >400-10 Commerce Valley Dr E Fax: +1 905.771.6288 >Thornhill, ON Canada L3T 7N7 http://www.CherniakSoftware.com -- Alan Knight [|], Cincom Smalltalk Development [hidden email] [hidden email] http://www.cincom.com/smalltalk "The Static Typing Philosophy: Make it fast. Make it right. Make it run." - Niall Ross |
Just a teaser: in my presentation at the ESUG summer conference in
september (www.esug.org) I will talk about packaging runtimes for small/freeware/shareware applications in VisualWorks, which includes another solution for this problem using the Settings tool. Rob Vens 2006/5/29, Alan Knight <[hidden email]>: > I would think number four sounds good. You just have to set the noWindowBlock to prevent it from trying to re-open a launcher. And saving the image with no windows will require you to fork off something to close and save, but that's not that complicated. So, e.g. > <get ready, close launcher> > > WindowManager noWindowBlock: [:x | ]. > > [MyAppModelWorkspaceOrWhereverIAmDoingThisFrom builder window controller closeAndUnschedule. > (Delay forSeconds: 1) wait. "Just let everybody else finish what they might be doing" > Snapshot new saveAs: 'theResult' thenQuit: true] > forkAt: Processor userBackgroundPriority. > > To open the window, easiest way would probably be to implement #main in a UserApplication subclass and throw in a > DeploymentOptionsSystem current startInRuntime: true. > in the above, or a -runtime on the command line. > > If you don't close the launcher, and use the -runtime on the command line, then you won't get a usable finished product, but your edit/save image/debug loop will be a lot easier while you're debugging. > > At 07:33 AM 29/05/2006, Dennis Smith wrote: > >I just spent a few hours trying to build a .exe for windows such that > >the single window would open at a location defined by the user and > >saved in a file to be read at startup. > > > >Here are the things I tried > > 1. window moveTo: on startup -- the window of course shows in its old location then jumps. > > 2. unmap the window before saving -- it gets remapped on startup, so you the jump again > > 3. minimize the window, move it and then expand it -- of course you cannot move it while minimized > > 4. close it, save the image, re-open on startup -- you cannot have an image with no window open > >This seems like a fairly simple thing to want to do!!! > > > >Here is what I finally came up with -- any better suggestions would be appreciated: > > - minimize (collapse) the window just before the final image save > > - on startup, open a new window > > - once that window is open, close the minimized window > > > >A bit convoluted?? > > > >-- > >Dennis Smith [hidden email] > >Cherniak Software Development Corporation +1 905.771.7011 > >400-10 Commerce Valley Dr E Fax: +1 905.771.6288 > >Thornhill, ON Canada L3T 7N7 http://www.CherniakSoftware.com > > -- > Alan Knight [|], Cincom Smalltalk Development > [hidden email] > [hidden email] > http://www.cincom.com/smalltalk > > "The Static Typing Philosophy: Make it fast. Make it right. Make it run." - Niall Ross > > |
In reply to this post by Dennis smith-4
Given a Rectangle representing the desired window position, how about
doing this on your subclass of ApplicationModel: self allButOpenInterface: #windowSpec. self builder window openIn: aRectangle. Chris On 5/29/2006, "Dennis Smith" <[hidden email]> wrote: >I just spent a few hours trying to build a .exe for windows such that >the single window would open at a location defined by the user and >saved in a file to be read at startup. > >Here are the things I tried > 1. window moveTo: on startup -- the window of course shows in its >old location then jumps. > 2. unmap the window before saving -- it gets remapped on startup, so >you the jump again > 3. minimize the window, move it and then expand it -- of course you >cannot move it while minimized > 4. close it, save the image, re-open on startup -- you cannot have >an image with no window open >This seems like a fairly simple thing to want to do!!! > >Here is what I finally came up with -- any better suggestions would be >appreciated: > - minimize (collapse) the window just before the final image save > - on startup, open a new window > - once that window is open, close the minimized window > >A bit convoluted?? > >-- >Dennis Smith [hidden email] >Cherniak Software Development Corporation +1 905.771.7011 >400-10 Commerce Valley Dr E Fax: +1 905.771.6288 >Thornhill, ON Canada L3T 7N7 http://www.CherniakSoftware.com > > > |
Free forum by Nabble | Edit this page |