re: Is it possible to resize a form at runtime?
I don't believe you can resize an existing form. However, you can dynamically create a form and specify the size at creation time. Check out FrmNewForm(). -Greg Wilson Developer Services PalmSource, Inc. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: Is it possible to resize a form at runtime?
Hi, this should do it. Modal forms are a bit tricky you will have to adjust the rectangle by 2 (the form frame). WinHandle frmWinH = FrmGetWindowHandle(frmP); WinGetBounds(frmWinH, &formBounds); // do something with formBounds WinSetBounds( frmWinH, &formBounds ); Best regards, Miro Pomsar - Original Message - From: "Vesselin Bontchev" <[EMAIL PROTECTED]> To: "Palm Developer Forum" Sent: Thursday, March 17, 2005 19:40 Subject: Is it possible to resize a form at runtime? > My application displays various data on a small popup dialog. The dialog is implemented as a modal form. > > Depending on the contents of the data, the contents of some fields on this form don't make sense. So, at runtime, when I determine that this is the case, I simply hide them from the form, using FrmHideObject. However, then the form looks half-empty, which no less ugly than displaying empty fields. > > So, my question is - is it possible to resize the form before it is displayed, in order to reflect how much data will be contained on it? > > I suspect that the answer is no, because I couldn't find an API for this purpose (there is an API that returns the size of the form - FrmGetFormBounds - but there isn't an equivalent "FrmSetFormBounds"), but I thought that it wouldn't hurt to ask - maybe I have missed something. > > Regards, > Vesselin > -- > For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: Is it possible to resize a form at runtime?
Vesselin Bontchev wrote: > So, my question is - is it possible to resize the form before > it is displayed, in order to reflect how much data will be > contained on it? > > I suspect that the answer is no, because I couldn't find an > API for this purpose (there is an API that returns the size > of the form - FrmGetFormBounds - but there isn't an equivalent > "FrmSetFormBounds"), but I thought that it wouldn't hurt to > ask - maybe I have missed something. I think it's worth a try to use WinSetBounds(). If you look at the Form.h head file, you'll see that the first member of the FormType struct is a WindowType. And the OS sample source treates a FormPtr the same as a WinPtr in a couple of places, like the implementation of FrmGetWindowHandle() where it just calls WinGetWindowHandle() with the formptr you passed it. And then if you look at the CollapseUtils stuff (from the SampleCollapse zip file), the way it responds to events the display resizing is to resize the form with WinSetBounds(): frmWinH = FrmGetWindowHandle(frmP); ... WinSetBounds( frmWinH, &formBounds ); The comment right before it does the WinSetBounds() is, "Increase/Decrease form height and width", and right after, (before a "return true") it says, "return that form has changed size". So, whether it's supported or not (especially, perhaps on older devices where the display can't stretch from 320x320 to 320x480) is a question I can't answer, but the point is that it seems this semi-official source code doesn't seem to make a distinction between a window and a form when it's resizing. In effect, it's like a form is a subclass of a window. - Logan -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: Is it possible to resize a form at runtime?
Hmm... It worked, mostly. First of all, I used FrmGetFormBounds instead of WinGetBounds, because the emulator (running PalmOS 3.5) complained about WinGetBounds that it requires version 4.x or something like that. Second, modal forms are indeed "tricky". By trial and error I discovered that, in order to preserve the frame, if I want to reduce the form's vertical size by DELTA, I have to do FrmGetFormBounds (frmP, &formBounds); formBounds.extent.x -= 2 + 2; formBounds.extent.y -= DELTA; formBounds.topLeft.x += 2; formBounds.topLeft.y += DELTA - 2; WinSetBounds (frmWinH, &formBounds); That is, provided that I want to shrink the form from the top, while still having it laying on the bottom of the screen. That did the job of resizing the form, alright. Unfortunately, as a result, the "OK" button of the form dropped out of sight. :-) So, I had to move it up: buttonIndex = FrmGetObjectIndex (frmP, kMyFormOKButton); FrmGetObjectPosition (frmP, buttonIndex, &x, &y); y -= DELTA; FrmSetObjectPosition (frmP, buttonIndex, x, y); Now, the resulting code works fine on the real device I have (Tungsten E, running PalmOS 5.2.1). However, when run on the POSE (under PalmOS 3.5), there is a rather bizarre effect. The "OK" button of the form doesn't always catch taps properly. Sometimes I have to "fish" for the place on the button that would catch the tap. But it doesn't happen always, and even when it happens, the tap is caught eventually and within the limits of the button - i.e., it's not as if I have to tap where the button originally was. I wonder whether this is some quirk of POSE, of PalmOS 3.5, or whether there is something else that I'm not aware of. (For instance, maybe I should move the button after the form has been displayed? Or maybe I should hide the button before moving it, or something like that?) Thanks for the help anyway. Where is this SampleCollapse thingy BTW? I checked the Samples folder of PODS, of SDK-5r4 and of SDK-6.1 and while there are various samples there, there isn't anything called SampleCollapse or CollapseUtils. Regards, Vesselin -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
RE: Is it possible to resize a form at runtime?
frmMain.Height = 30 .Width .Top .Left Is that what you mean? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Greg Wilson Sent: Thursday, March 17, 2005 13:05 To: Palm Developer Forum Subject: re: Is it possible to resize a form at runtime? I don't believe you can resize an existing form. However, you can dynamically create a form and specify the size at creation time. Check out FrmNewForm(). -Greg Wilson Developer Services PalmSource, Inc. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
RE: Is it possible to resize a form at runtime?
SampleCollapse can be found in the PalmSource Knowledge Base. Just search for "SampleCollapse" and you'll be taken right to it. -Greg Wilson -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
RE: Is it possible to resize a form at runtime?
> frmMain.Height = 30 > .Width > .Top > .Left > > Is that what you mean? No, most definitely not. First of all, an object of the type FormType does not have such fields. Perhaps you meant something like frmMain->window.windowBounds.extent.y = 30; or something like that. However, the PalmOS documentation quite explicitly warns not to access directly the elements of the FormType and WindowType structures and not to expect the names, places or even existence of their fields to remain the same accross the various PalmOS versions. So, no, the above is most definitely not what I don't want to do. I was asking how to resize a form strictly with the provided APIs. Regards, Vesselin -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: Is it possible to resize a form at runtime?
On Thu, Mar 17, 2005 at 09:41:33PM -, Vesselin Bontchev wrote: > Where is this SampleCollapse thingy BTW? I checked the Samples folder > of PODS, of SDK-5r4 and of SDK-6.1 and while there are various samples > there, there isn't anything called SampleCollapse or CollapseUtils. This is sample code for supporting the dynamic input area (DIA) on the Tungsten T3 and T5. DIA support means resizing forms all the time, so it's a good place to look at how to resize forms in general. -- Dave Carrigan Seattle, WA, USA [EMAIL PROTECTED] | http://www.rudedog.org/ | ICQ:161669680 UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/