Problem With Form Size

RandomCoder

Well-Known Member
Licensed User
Longtime User
Maybe I'm just a little rusty having not played with B4PPC for a few weeks, but this problem seems to have got the better of me....

I have one Form that is hidden using it's visible property, this is accessible via the taskbar (my application is used on the desktop only!)
At a set time I want to display another Form much like a message box but with added options/controls.
This I've been able to do easily enough but for some reason I cannot change its size :confused:
The Form always occupies the same area as the first hidden Form would occupy. Setting the Form Height and Width does nothing.
I've tried refreshing the Form afterwards but this has no effect. As I am already using the door library to remove the control box I have also tried using this to set the Form height and Width but still no joy.

Are my problems due to having the first Form hidden and if so how can I overcome this?
I've tried Setting the Form screen size in the IDE but this affects both Forms :(

What I would like to acheive is a pop up message box with custom controls that will allow the user to accept, cancel or be reminded in x amount of days.

If needed I can attach my code but as I'm using several libraries I thought it best to ask the question first as am sure to have overlooked something really simple.

Regards,
RandomCoder
 

agraham

Expert
Licensed User
Longtime User
This is normal behaviour. All the B4ppc forms in an app are the same size. If you want more flexibility on the desktop then try my FormExDesktop library http://www.b4x.com/forum/additional...formexdestop-controlsexdesktop-libraries.html

Note that despite what it implies in the help you can no longer mix standard Forms and FormExs in an app. You used to be able to when I originally wrote the library but changes in B4ppc over time mean that the first Form shown, even after a FormEx, becomes the main form and the app closes when that form is closed.

When the latest version of B4ppc is released I will be releasing a new version fully compatible with modules so I will update the help then, once I have characterised the behaviour properly.

EDIT :- Damn (again :)!) Erel got in while I was composing a reply.
 
Last edited:

RandomCoder

Well-Known Member
Licensed User
Longtime User
Thanks guys.

Guess its about time I upgraded to the next version ;) but will this mean that I need to place my existing code into modules :sign0148: or are modules just an added feature that can be used if desired?

Regards,
RandomCoder
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
but will this mean that I need to place my existing code into modules
sign0148.gif
or are modules just an added feature that can be used if desired?
The new (beta) version is backwards compatible. All your code will appear in the main module and you can continue to work as usual.
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Thats great news, thanks Erel!

##### New subscription on its way :sign0060: #####

Regards,
RandomCoder
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Using FormExDesktop....

I'm now trying to move my app across to use the FormExDesktop library as suggested above, but after adding a FormEx Object called AdvancedProperties I seem unable to use the Form I created within the IDE.

I've tried AdvancedProperties.New1("FormName") which has added the Form from the IDE but none of the controls that were placed within it. Where have I gone wrong?

Regards,
RandomCoder.

PS, Still waiting for PayPal to process my payment, then I'll be bang up to date :sign0060:
 

agraham

Expert
Licensed User
Longtime User
Where have I gone wrong?
Does the demo work for you? There is a lot of detail in there showing how to do a lot of things with a FormEx.

You do realize that FormEx replaces, not enhances, a standard form! If the form shows without controls it sounds as though you have started the app with Formname.Show (from which all the controls have been stolen) and not AdvancedProperties.Run.
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
With a little more experimentation I have found where I am going wrong....
Instead of using the normal FormName.Show this needed to be replaced by AdvancedProperties.Run so as to call up the new extended form.

Regards,
RandomCoder
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Agraham your far too quick for me ;)
I'm sure there will be plenty more hurdles for me to jump yet so I'm sure that I will be needing your help in the non too distant future.

Thanks,
RandomCoder
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Agraham,

Is there a reason why my applicatoin is erroring with the following message...
Unable to cast object of type 'Systems.Windows.Forms.Form' to type 'Dbasic.EnhancedControls.CEnhancedForm'.

I feel that it has something to do with the image buttons that were added using the IDE as these seem to be the only things that fail to display correctly when I ignore the error.
I should also mention that I am still on version 5.8 at the moment (work laptop) whilst I await for my upgrade to be processed. Not sure if this could also be affecting things?

Regards,
RandomCoder
 

agraham

Expert
Licensed User
Longtime User
I feel that it has something to do with the image buttons
It is the image buttons, but it will only happen if the button has its Transparent property set True. When an image button is transparent it tries to copy its background from a CEnhancedForm object type, which is what a B4ppc form is, which it expects to be sitting on, rather than a Form object type, which is what a FormEx is, that it is actually sitting on.

I am afraid that there is no work around for this as a normal Form treats its background image entirely differently to a CEnhancedForm due to the existence of the Forelayer on a CEnhancedForm.
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Thanks for the swift reply.

LAST QUESTION (hopefully!)

Am I able to use a normal B4PPC Form in combination with other FormEx Forms (if that makes sense :confused:)
I only really need to use a FormEx so as to make a custom message box whilst all other Forms could remain standard B4PPC ones.

Regards,
RandomCoder
 

agraham

Expert
Licensed User
Longtime User
Am I able to use a normal B4PPC Form in combination with other FormEx Forms
Yes, as long as the main form is a normal form. From the amended help file I will post with the next version.
Run : Run this FormEx as the main form of an application. You start an application by either a Form.Show of a Basic4ppc form or a FormEx.Run of an extended form. Unlike Show on a normal Form, Run on a FormEx does not return until the application closes so any statements after a Run will only be executed at close. Note that you have to explicitly close this main FormEx to stop the IDE debugger, stopping debugging in the IDE will not close an application started by Run. Show all other forms, do NOT Run them. Only one FormEx needs to be Run and that becomes the main form of the application.

If Form is a normal Basic4ppc form and is the first form to be shown then Form.Show will display as it as the main form and close the application when it is closed. It is OK to Show other native Basic4ppc (non-extended) forms as well as extended forms in the application. Do NOT Run any extended forms, they must be Shown.

If FormEx is an extended form and is the first form to be shown then FormEx.Run will display the extended form as the main form and close the application when it is closed. Do not use native Basic4ppc (non-extended) forms in the application as Basic4ppc will think that the first one of them shown is the main form and will close the application if that form is closed.
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Thanks for your help Agraham its very appreciated!

Regards,
RandomCoder
 
Top