Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Is there a way to keep the screen in the same location.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-26-2007, 05:30 PM
Junior Member
 
Join Date: May 2007
Posts: 31
Question Is there a way to keep the screen in the same location.

I have a windows app version for the PC that connects to my PPC.
I move the app on my pc screen to a different location than the center.
If I select a new screen, the other window is unhidden and shows at the old location. Is there a way to set the location of the app so that the unhidden screens will not show in different places.
Reply With Quote
  #2 (permalink)  
Old 07-26-2007, 06:21 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,687
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

It's undocumented and Erel might have something to say about it but the following works with the usual caveat about making use of undocumented functionality. I guessed that this might work as a Form is a sort of control and all the other controls have Top and Left properties so why not a Form?

There are two Forms, Form1 and Form2. Form1 has Button1, Form2 has Button2. The Form must be built in order for the properties to be present to be set so there is an unavoidable screen jump when Form2 is first displayed but afterwards the forms follow each other nicely around the screen.
Code:
Sub Globals
Dim Firsttime
End Sub

Sub App_Start
Firsttime = True
Form1.Show
End Sub

Sub Button1_Click
If Firsttime=True then
Form2.Show
Firsttime = False
end if
Form2.Top = Form1.Top
Form2.left = Form1.left
Form2.Show
End Sub

Sub Button2_Click
Form1.Top = Form2.Top
Form1.left = Form2.left
Form1.Show  
End Sub

Last edited by agraham : 07-26-2007 at 06:26 PM. Reason: Missed out setting Firsttime to False in App_Start
Reply With Quote
  #3 (permalink)  
Old 07-26-2007, 06:22 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,314
Default

In the desktop, you can shoose diferent form sizes to your app, so you you size your form to the current screen resolution, it will cover the entire screen...But this maybe is not what you want...still I've noticed that a reduced size form if "maximized" is putted to the 0,0 position on the screen (Top Left)...

Edit : I missed Agraham's post!!
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #4 (permalink)  
Old 07-27-2007, 09:22 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,132
Default

angraham solution is a good solution and should work properly.
Reply With Quote
  #5 (permalink)  
Old 07-28-2007, 06:46 PM
Junior Member
 
Join Date: May 2007
Posts: 31
Default Still Working on this ...

I have applied the example to my code with some modifications.
I noticed the unavoidable screen jump and am trying to avoid it.

My situation:
I love the PPC size for the PC Screen.
Also I have 18 screens on my app.


So here is a rundown of what I am doing and most of it is working out well. Still having issues with the screen jump.

1.Start App
2. I Initialize all the screens (via a sub-routine) so that I can get the Top and Left Properties and because they initially start in the same location.
3.At the top of each show I make a call to a function which reads in the Previous screen (via a global variable) and New screen. It takes the string names using the Control and sets the New Top/Left to equal the Previous.
And then the new string is set as the Previous.



Step 3 works perfectly. The only problem that I am having is the startup when I have all the screen jumps. I will try setting all the controls on the screen to be not visible and then resetting them later. It's just to a layman the screen jumps may not come off well.


What do you think about my process? It was the most efficient one that I could come up with. But the #1 may not be a good idea? Does it screw up /slow down anything to open all the forms?

Thanks for the starter Agraham and thanks for B4PPC Erel. And thanks for taking the time to look at my post CableGuy.
Reply With Quote
  #6 (permalink)  
Old 07-28-2007, 07:53 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,687
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

The screen jump occurs because when a screen is first shown its Top and Left properties are set to a default and the screen is displayed there before the Top and Left properties are available to be altered.

If your step2 is doing what I suspect, that is looping round the screens before they are shown and setting their Top and Left properties, then this will not work as at this stage the screens do not exist although B4PPC does not throw an error. A screen only exists once it is shown for the first time, only then are the properties available.

Step 3 sounds fine and from what you say apparently works.

I have a couple of thoughts for a workaround that I will post if they work but that will be tomorrow now as food calls!
Reply With Quote
  #7 (permalink)  
Old 07-28-2007, 08:11 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,314
Default

18 Screens?!
Wow, thats a lot of screens...
are they design created or runtime created screens?

As agraham states, a screen only exists after 1st presentation, so I would suggest this aproach..

on fresh run, shown all forms in reverse order, thsi should only take a few ms....

By doing this you make all forms existing so they can be propertie changed...

Then when showing a form other than main form (form1 by default), re-set the position of the form you want to show....

this eliminates the "jumping" efect, and the first few ms should be almost un-noticeable....
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #8 (permalink)  
Old 07-29-2007, 03:54 AM
Junior Member
 
Join Date: May 2007
Posts: 31
Default A little explanation of Number 2

What I meant by initializing all the forms is exactly what Cableguy suggested,
I initialize all the screens by .show for each one. This works except I am getting blips of each screen. I am working on putting all the functionalities in panels and not making visible until later. I will see how this works.

I noticed that the screens with little to no major controls ran through without a trace.
Reply With Quote
  #9 (permalink)  
Old 07-29-2007, 10:19 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,687
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

The only thing I can think of is to do the following.

First make a small app. that can act as a splash screen with an initialisation message that closes itself after a delay

Code:
Sub Globals
End Sub

Sub App_Start
	Form1.Show ' form has please wait message or similar
	x = timeadd(now,0,0,3)
	do
	 doevents ' important! lets the screen finish drawing itself
	loop until now > x
	appclose
End Sub
Now write your main app with its first form a copy of the splash screen app. Then immediately on startup of your main app shell the splashscreen app and then show all your other screens in turn.
Code:
Sub App_Start
Form1.Show ' must show here or the first show will be in front of splash screen
shell("splash.exe")
' need a slight delay here to let splash screen load
x = timeadd(now,0,0,1)
do
doevents
loop until now > x
' now show all forms, may need a doevents to let them be drawn in turn or may not
End Sub
The splash screen will appear in front of your main app and will hide the screen drawing as AS LONG AS you have shown your first form before shelling, otherwise your first form.show will appear in front of the splash screen. You will need a delay in your main app before you start showing the screens in turn to let the splash screen load and initialize.

There is still a single disturbance on the screen as the main app displays first then the splash screen loads on top off it. Perhaps you could tune the delays and messages so that it looks a deliberate thing. The main screen displays one startup message, waits for the user to read it then shells the splash screen which displays another related message while the main app loads all its' forms.
Reply With Quote
  #10 (permalink)  
Old 07-29-2007, 12:11 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,314
Default

I've played a while with splash screens, and they are, almost always, very simple to code....
I like agraham's idea, specially if you can came up with some litle animation on your splash screen, like a "loading app" bar.... Just an Idea...

@Agraham, You don't cease to amaze me...I've never would have thought on shelling a startup app to cover the forms initialization...Great work..
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen Capture App sahoopes Share Your Creations 3 04-17-2008 08:05 AM
How to clear the screen ? gjoisa Questions & Help Needed 1 03-11-2008 05:50 PM
Cableguy's location dzt Chit Chat 14 10-14-2007 09:22 PM
File Location and Setting Paths XerVision Questions & Help Needed 2 06-25-2007 10:51 PM
Default Installation Location conniemalan Basic4ppc Wishlist 1 05-15-2007 02:54 PM


All times are GMT. The time now is 01:20 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0