Some HELP with NativeFormImage/NativeImage please

HARRY

Active Member
Licensed User
Longtime User
Hallo everybody,

I am struggling with the subject above.

What do I want? A complete form should be filled with a picture file. This is permanent, in fact this is a map. Then I need to draw a number of circles on that form, indicating locations. Clicking on that form, these circles should be refreshed with circles possibly on other places and in other colours, so the 'old' circles should be erased, but not the 'map'.

Could somebody indicate me how to realize that. I need the Native stuff because the program should run on various devices.

Studying the examples of the Native stuff, didn't help me to solve my 'problem'.

Thanks in advance,

Harry
 

agraham

Expert
Licensed User
Longtime User
I need the Native stuff because the program should run on various devices.
You only need the native resolution controls if you want to use the full resolution on a VGA device for an AutoScaled application. Writing the application as usual assuming a 240 x 320 screen then compiling it AutoScaled will run correctly on a 480 x 640 device. What you will get however is slightly "blurry" graphics as the 240 x 320 graphics are being stretched to fill the larger screen. Only if the resulting blurring is not acceptable on a VGA device will you then need to use the native resolution controls so start off without them and see how it goes.

The answer to your main question is to draw the map on the backlayer of a Form and draw the circles on the forelayer which can be erased independently.
 

HARRY

Active Member
Licensed User
Longtime User
Hallo Agraham,

Thanks again. In many cases a few words are enough to bring the user on the right track. I did notice a few things which are not worth a separate post, but could be interesting for others:

1) On a form there is only a label; using a Native Form Image object I draw a picture on the form completely covering the form. I compile with AutoScaling. Now on the device a part of the drawn image is disturbed; apparantly the (repositioned) label has 'moved' a part of the image with the size of the label.

2) A sub redraws circles on the foreground. I happend to have the
MapForm.ForeLayer=True
NFormImage.SetNativeForeLayer("MapForm")
statements in this routine.
On the device, exactly after 25 times redrawing a got a OutOfMemory exception. I do not know the meaning of this message: no more memory available or adressing outside the allocated memory. This error was reproducable. A moved those two statements to an initialisation sub and the problem was over.

Now, everything works fine. Thanks again,

Harry
 

agraham

Expert
Licensed User
Longtime User
1) I assume your label was transparent. This will happen as the label picks up the wrong part of the background as it doesn't know the native image size. This effect will probably happen (I haven't checked the code) with any transparent control.

2) SetNativeForeLayer allocates a new bitmap without disposing of the old so the old bitmaps build up in memory until you run out of memory. As you have found SetNativeForeLayer (and SetNativeBackLayer) is only needed to be invoked once in a program.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…