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.


Image gets lost with orientation change


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-11-2007, 12:21 PM
Knows the basics
 
Join Date: Apr 2007
Location: Netherlands
Posts: 86
Default Image gets lost with orientation change

Erel,

I create a form on the desk top in landscape orientation; before running the program (A) on the device I set, manually, the screen orientation to landscape. I show an image by some click. It works fine.

Now I change the orientation either manually or I start in addition another program which also changes the orientation. Returning to program A the image ist lost and also cannot be shown again.

It sounds complicated, therefore I have attached a small program to illustrate the problem.

Can you explain these strange things and do you see a solution?

Harry
Attached Files
File Type: zip Orientation.zip (59.9 KB, 14 views)
Reply With Quote
  #2 (permalink)  
Old 05-11-2007, 02:14 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

Using the FormLib library you can catch the Resize event.
You must add a FormLib object to your form if you want to handle screen orientations.
Reply With Quote
  #3 (permalink)  
Old 05-11-2007, 02:40 PM
Knows the basics
 
Join Date: Apr 2007
Location: Netherlands
Posts: 86
Default

Erel,

As you can see in the test program I sent with the post, there is a FormLib object and the screen orientation change event is caught.

Harry
Reply With Quote
  #4 (permalink)  
Old 05-11-2007, 03:08 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Hi,

Im not an expert in this isue, if any, but in the resize event you should test the witdh and height of the form and re-position it in the form.
The resize event alone doe not change the form item position, it only allows you to execute code on the resize event...
__________________
Paulo Gomes
Porto, Portugal

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

DLL Version Listing
Reply With Quote
  #5 (permalink)  
Old 05-11-2007, 03:51 PM
Knows the basics
 
Join Date: Apr 2007
Location: Netherlands
Posts: 86
Default

Paulo,

In the test program I just have one small image positioned in the middel of the screen. Whatever the orientation is, it should be visible without repositioning.

I worked with and without the resize event. Using the resize event I refreshed the destination rectangel.

But even loading the image again does't show the image.

Harry
Reply With Quote
  #6 (permalink)  
Old 05-11-2007, 04:43 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

As Cableguy wrote you should use the Resize event to draw (not refresh) the image again.
All the previous drawings are erased when the user changes the screen orientation.
Reply With Quote
  #7 (permalink)  
Old 05-14-2007, 09:12 AM
Knows the basics
 
Join Date: Apr 2007
Location: Netherlands
Posts: 86
Default Image gets lost with orientation change

Hi,

Use of the DrawImage method does not improve the situation. I have attached a somewhat more elaborated test program. Running it you will see the problem. The image cannot be made visible again by (re)drawing it in the resize event nor on a second click on the form. Worst is that I don't see a work around.

Harry
Attached Files
File Type: zip Orientation.zip (60.5 KB, 9 views)
Reply With Quote
  #8 (permalink)  
Old 05-14-2007, 10:19 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

You are right there is an issue when you combine a Drawer object and the resize event.
When the resize event fires a new bitmap is created for the form.
The solution is to recreate the drawer object again:
Code:
Sub Globals

End Sub

Sub App_Start
    Form1.Show
    flb1.New1("Form1",B4PObject(1))
    bm1.New1(Apppath & "\Dummy2.bmp")
    drawer1.New1("Form1",false)
    rectsrc.New1(0,0,320,240)    
    rectdes.New1(100,125,80,60)
    flb1.FullScreen(false) 'this will remove the menu bar and raise the resize event (the screen size changes).
End Sub

Sub flb1_resize
    if Form1.Width > Form1.Height then
        msgbox("Landscape")
    else
        msgbox("Portrait")
    end if
    drawer1.New1("form1",false)
    drawer1.DrawImage1(bm1.Value,rectsrc.Value,rectdes.Value,true)
    drawer1.Refresh2(rectdes.Value)
End Sub    
    

Sub Form1_MouseUp (x,y)
    msgbox ("Form clicked")
    drawer1.DrawImage1(bm1.Value,rectsrc.Value,rectdes.Value,true)
    drawer1.Refresh2(rectdes.Value)
End Sub
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
Bitmap Value Lost? fjsantos Questions & Help Needed 7 06-16-2008 07:04 PM
Change Image width and Height Georg Questions & Help Needed 3 05-13-2008 04:19 PM
i lost treeview.dll after loading V6 dan kabestan Questions & Help Needed 1 01-03-2008 12:57 PM
Change screen orientation programmatically?? HARRY Code Samples & Tips 11 10-09-2007 03:40 PM
sceen orientation Filec Questions & Help Needed 3 07-13-2007 01:34 PM


All times are GMT. The time now is 06:22 AM.


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