Page 1 of 1

PostPosted: Tue Aug 20, 2002 12:15 am
by juha2u
I am having problems switching forms with Ccontrols. My program has a data entry screen that stores info to a database and then switches to a screen that shows totals. I use clearg() and the screen clears (after 2 or 3 clicks on the button) but the text boxes still activate when I click on the correct position on the blank screen. I have also tried using the dbclose function but that did not work either. I have seen postings for Ptoolbox but with over 800 lines of code written, I really don't want to change. Am I missing something simple or perhaps there is a workaround.


PostPosted: Tue Aug 20, 2002 12:09 pm
by Steven
In order to properly close a CControls form, you must use CDestroy to remove the controls (including the frame, if any) before clearing the screen. This also serves to remove the controls from memory. Alternatively, you could just use CErase on each control to clear the control from the screen without removing it from memory.

PostPosted: Tue Aug 20, 2002 4:38 pm
by juha2u
Thanks for the quick response.

I tried using Cdestroy for each label and edit box. The screen clears nicely but I can still bring up an edit box and invoke some button functions if I search for them on the blank screen. Oddly enough, some of the edit boxes and buttons truly are gone??? I am using Ccontrols v. 1.O. I read somewhere on this board of a "memory leak" problem using Cdestroy. Any thoughts? Also, does anyone know if a later version ever was released?

Sample code on switching forms would be greatly appreciated!

PostPosted: Tue Aug 20, 2002 5:11 pm
by Steven
I forgot to add that you must change message loops to go back to the message loop of the new/previous form. The message loop that you are in determines which controls are activated by pen taps.

PostPosted: Wed Aug 21, 2002 12:38 pm
by juha2u
I'm still very confused. Nothing I do seems to work. Perhaps I am using Cdestroy incorrectly or in the wrong place. Your comment on using separate message loops has me confused as well. Can someone possibly post or email me some sample code that demonstrates switching forms using Ccontrols. As I mentioned, I am still using Ccontrols 1.0 and perhaps the problem is with this rumored "memory leak". Is another version available? It's probably me, however, as I am only a few months into this programming stuff. The hours are mounting and my wife is suggesting I toss my PDA. Someone, please help!!!


PostPosted: Wed Aug 21, 2002 1:24 pm
by dcalp
Hi juha2u:
If you use Windows you can test my soft, is a desktop environment for visual design and PocketC code generation. You can get the code of 2 CControls forms that switch from one to other in seconds. Read the Quick Start section in the Help.
Also in my site is the CControls update 1.1.1 for download.


Pocket VisualForms
Visual design for PocketC

PostPosted: Wed Aug 21, 2002 1:35 pm
by juha2u

I'm off to your site now. Hopefully this will work.

Thanks so much.

PostPosted: Thu Aug 22, 2002 6:08 pm
by juha2u
Thanks to all. Cdestroy was not necessary at all. Creating two message loops did the trick. It took a little bit of time to get the code to work but switching forms works perfectly now.

DC, I checked out your site and the VisualForms product looks real easy to use. I will consider getting it. Thanks again.


PostPosted: Thu Aug 22, 2002 6:34 pm
by Steven
Cdestroy is still necessary to remove controls from memory after you have finished using them. This is especially important for listboxes, tables, etc., since the contents is still in memory until you execute Cdestroy (or exit the program).