Basic4ppc - Windows Mobile Development  

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

Basic4ppc Wishlist Missing any feature?


Windows position


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-07-2008, 11:15 PM
Junior Member
 
Join Date: May 2007
Posts: 29
Default Windows position

Hi,
When user launched a Basic4PPC-compiled as Windows app, the application will starts in the center of the desktop screen. When user moves the app to a different location, subsequent forms will move back to the center. However, subsequently when the same form is being accessed, the position where the form was previously is used.

A request here.. when the app is moved to a different location, it would be great to have all forms shown on the same location in the first instance, rather than in the center.
Reply With Quote
  #2 (permalink)  
Old 05-08-2008, 05:45 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,306
Default

You can use the following code to set the position of the next form:
Code:
Sub App_Start
    Form1.Show
End Sub


Sub Button1_Click
    form2.Show
    form2.Left = form1.Left
    form2.Top = form1.Top
End Sub
Reply With Quote
  #3 (permalink)  
Old 05-08-2008, 06:03 AM
klaus's Avatar
Basic4ppc Veteran
 
Join Date: Oct 2007
Location: Switzerland
Posts: 256
Awards Showcase
Competition Winner 
Total Awards: 1
Default

If you want that at the next start of the desktop program the Main form is placed at the position where it was the last time, you can save it's coordinates in a file and read it at start-up and position the Main form. And then the others with Erel's code.

Best regards
__________________
Klaus
Switzerland

Last edited by klaus : 05-09-2008 at 06:08 AM.
Reply With Quote
  #4 (permalink)  
Old 05-08-2008, 11:25 PM
Junior Member
 
Join Date: May 2007
Posts: 29
Default

Hi All,
Thanks... I think saving to a file or registry is better as users can move the app from 'any form'.. and need not be in Form1... as it's all transparent to them.. this way, regardless of which Form they're in.. it will be displayed in the 'last moved position'.

Thanks to all!!!
Reply With Quote
  #5 (permalink)  
Old 05-10-2008, 03:11 PM
Junior Member
 
Join Date: May 2007
Posts: 29
Default

Hi Erel,
I tried using the methods suggested. It works.. but noticed there was 'flashing' of the windows from center to the position moved. This is obvious when the Form is displayed the first time. Subsequently it will not.

In your example..

Sub Button1_Click
form2.Show
form2.Left = form1.Left
form2.Top = form1.Top
End Sub

Form2 was shown before the 'moving' was done. If I changed it to:

Sub Button1_Click
form2.Left = form1.Left
form2.Top = form1.Top
form2.Show
End Sub

the Form2 will not moved to the new coordinate the first time Form2 was shown, however it will recognise the coordinate on subsequent display of Form2.

Is there a way to prevent the 'windows flashing' from being seen?
Reply With Quote
  #6 (permalink)  
Old 05-10-2008, 03:53 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,306
Default

This code will prevent the flashing (door is a Door object):
Code:
Sub App_Start
    Form1.Show
    door.New1(false)
    door.FromControl("form2")
    door.SetProperty("StartPosition","Manual")
'    door.FromControl("form3")
'    door.SetProperty("StartPosition","Manual")
'    ...
End Sub


Sub Button1_Click
    form2.left = form1.left
    form2.top = form1.top
    form2.Show
End Sub
Reply With Quote
  #7 (permalink)  
Old 05-11-2008, 02:51 AM
Junior Member
 
Join Date: May 2007
Posts: 29
Default

Hi Erel,
Thanks... will definitely test the DOOR library...
Reply With Quote
  #8 (permalink)  
Old 05-11-2008, 07:37 AM
klaus's Avatar
Basic4ppc Veteran
 
Join Date: Oct 2007
Location: Switzerland
Posts: 256
Awards Showcase
Competition Winner 
Total Awards: 1
Default

Hi Erel and WZSun,
Works fine !
I modified the code a bit to postion also the first form, in some programs I have only one form.

Code:
Sub App_Start
    LoadInit             ' reads the position of the main form frmTop and frmLeft

    door.New1(false)

    If Not(CPPC) Then
      door.FromControl("form1")
      door.SetProperty("StartPosition","Manual")
    End If

    Form1.Top=frmTop  ' sets the position
    Form1.Left=frmLeft
    Form1.Show

    If Not(CPPC) Then
      door.FromControl("form2")
      door.SetProperty("StartPosition","Manual")
'      door.FromControl("form3")
'      door.SetProperty("StartPosition","Manual")
    End If
'    ...
End Sub
Best regards
__________________
Klaus
Switzerland

Last edited by klaus : 05-12-2008 at 11:27 AM.
Reply With Quote
  #9 (permalink)  
Old 05-12-2008, 11:32 AM
klaus's Avatar
Basic4ppc Veteran
 
Join Date: Oct 2007
Location: Switzerland
Posts: 256
Awards Showcase
Competition Winner 
Total Awards: 1
Default

The code in my previous post has been modified.

It must be
Code:
  If Not(CPPC) Then
    door.FromControl("form1")
    door.SetProperty("StartPosition","Manual")
  End If
Otherwise there will be a Null Exception error on the divice.

Best regards
__________________
Klaus
Switzerland
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
Pass Text into other application at current cursor position...? TWELVE Questions & Help Needed 2 04-30-2008 07:49 AM
Tables - column position LineCutter Questions & Help Needed 6 02-22-2008 02:30 PM
Position TextBox or Button in centre of form burd27 Questions & Help Needed 6 02-16-2008 05:12 AM
Not losing cursor position after running/compiling Woinowski Basic4ppc Wishlist 0 01-16-2008 07:18 AM
Position of form designer pixelpoint Basic4ppc Wishlist 0 08-16-2007 12:51 PM


All times are GMT. The time now is 03:41 AM.


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