Build proper desktop apps in B4PPC with this awesome Forms library

BjornF

Active Member
Licensed User
Longtime User
Form disappearing...

I have been playing around with the FormExDesktop example and I thought I understood how it worked, but apparently not.

In the example attached I have first created a form with two buttons and then used the New1 method to create an extended form. When I try to show the form it just shows on the screen and then disappears. Putting a msgbox command before the end of the App_Start sub prevents the form from disappearing. No errormessages.

I am obviously doing something wrong but I can't understand what. :(

Any help would be appreciated.

all the best / Björn
 

Attachments

  • Reference program.zip
    9.7 KB · Views: 30

agraham

Expert
Licensed User
Longtime User
To start the app off you need to do either a Show on a native B4PPC Form or a Run on a FormEx Form (but not both). Both of these methods start a message handling loop which the application needs in order to keep running. You are Showing a FormEx so replace your "Show" with "Run" and it works OK.

Show on a FormEx is different to a Show on a native Form. On a FormEx form it just makes it visible. On a native form the first Show in AppStart starts the message loop. Thereafter both Shows do much the same.

See the comments in the FormExDesktop example at the "Start Application" reqion that try to explain the constraints. I guess that I should have made that plain in the help file. Sorry.

Note that Close on a FormEx actually closes and disposes the FormEx. On a native Form it only hides it. Trap the Closing event on a FormEx as shown in the example "Closing events - makes it more like B4PPC" region and call CancelClose and Hide to get B4PPC behaviour. FormEx5 and FormEx6 - MDI Child windows - are not protected like this in the example and so get disposed if you close them.
 

Cableguy

Expert
Licensed User
Longtime User
Missing the cs file for merging, and for a minor mod...
I think I can do it my self, but wouldn't want to spoil your work...
I would like to ask you to add an "FormIcon" propertie, so that we could set the....form's icon....
Also, some merging with notify lib would be nice...
Thanks...
 

agraham

Expert
Licensed User
Longtime User
Missing the cs file for merging, and for a minor mod...
I'll think about that tomorrow.
I would like to ask you to add an "FormIcon" propertie, so that we could set the....form's icon....
From http://www.b4x.com/forum/additional...formexdestop-controlsexdesktop-libraries.html post #2 "Updated FormExDesktop 1.4 now has an additional property that allows the forms' icon to be specified."
Also, some merging with notify lib would be nice...
Do you mean the ControlsExDesktop library?
 
Last edited:
Top