Form color in landscape mode

HARRY

Active Member
Licensed User
Longtime User
Hi,

A program is originally written in portrait mode. When loaded, it investigates the formwidth/formheight relation and, if found that the device is in landscape mode, it rearranges a couple of objects.

The form itself, however, now has two colors;

On the device: the left part, roughly the width of the form in portrait mode, has the correct color, the 'added ' width part is grey;

On the desktop: the left part, roughly the width of the form in portrait mode has become green, the 'added ' width part is grey.

Nowhere in the program the color green is used.

Setting the Form color, after rearranging the objects has no result.

In portrait mode everything is OK.

Reacting on the Resize event, caused by using a hardware button, gives consistently the same results.

Who knows what I am doing wrong?

Harry
 

HARRY

Active Member
Licensed User
Longtime User
Erel,

Sure, both Forms have a FormLib object, flb1 and flb2 , used to set FullScreen and to intercept the Screen Size event, caused by the user pressing that Hard Key.

Sub flb1_Resize does some repositioning controls

Sub flb2_resize is empty as no repositioning is necessary

Harry
 

yildi

Member
Licensed User
I have solved this problem by adding a panel on the form and by adding controls to the panel instead of the form. I have found that panels do resize better than forms. Try it, it will solve your problem, I am pretty sure: add a panel that has the same size as the form (you can make it sure programmatically by Panel.Width=Form.Width, etc.) and place all controls to the panel (using the changeParent utility in the GUI editor or the corresponding method).

Murat
 

HARRY

Active Member
Licensed User
Longtime User
Erel,

I found the problem myself.

Some time ago I tried to implement some HELP function using the dzHtmlView library. Later on I found another solution, but I forgot to remove from the program the hc.New1("Form1",0,0,240,360) object . In the resize event, I did nothing with this object. By the sceen changing it came apparently to the foreground, although somewhat different on de desktop as on the device.

After removal of that object it works fine.

Your request to send the code urged me to have a second look in order not to bother you again with a no problem.

Harry
 

yildi

Member
Licensed User
It is strange that I have the same problem without such complications, just by adding controls to a form. When I go to landscape, the right side of the screen is not repainted (it remains gray even if the form is, for example, red). If i include a panel and resize it correctly (as a reaction of the corresponding FormLib event), the background adapts correctly.
Am I the only one having this problem (then I am probably doing something stupid...)?

Murat

EDIT: If I remember well, this problem was only appearing on my VGA PDA, not on the QVGA one.
 

yildi

Member
Licensed User
No, only to the main form. I have not understood that it was necessary for all forms. But I can see that all other controls are changed correctly as a consequence of the screen change event fired by the main form, even if I look to another one (this is how the adding of a background panel solves the resizing problem, this panel is automatically resized and it covers the totality of the background). Next time I use the resize trick, I will rather try to follow your suggestion (it will make me economize one panel per form)... :)

Murat
 
Top