PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Tyrone Lee on June 16, 2006, 01:25:24 AM

Title: Form_Load
Post by: Tyrone Lee on June 16, 2006, 01:25:24 AM
I am having trouble controlling my forms.. I can create simple/standard forms and accept data input, but I am having trouble simulating a Form_Load Event.

I want to Load the form, and based on outside criteria "setup" the buttons, and textboxes I want to be visible.

I have tried using the SHOWSTATE, %SW_HIDE but when the FRMNAME_Show() function is called my settings are being retained.

Any ideas?

Tye
Title: Form_Load
Post by: JR Heathcote on June 16, 2006, 04:09:10 PM
Tyrone,

The nearest thing FireFly has to the VB Form_Load event is ????_WM_CREATE, where ???? is the name of your form.  I put all of my form initialization code there.

A wish list item I would like to see in FireFly 3.0 is an INITIALIZE_DIALOG event in addition to ???_WM_CREATE, what about that Paul?
Title: Form_Load
Post by: TechSupport on June 16, 2006, 09:33:43 PM
Everything is up for grabs in Version 3. I do think that an initialize event is a good idea, however, the WM_CREATE message seems to serve the purpose 99.99999% of the time.
Title: Hey..
Post by: Tyrone Lee on June 16, 2006, 09:53:11 PM
I managed to get it to work.. Lemme show you my approach.. It seems kinda "cryptic" but I imagine I could do alot with this approach..

The WM_CREATE allows you to pass UserData as Long. (I pass a pointer to a STRING with data that I parse.)

CAPTION:Form Caption + $CRLF
PROMPT:Prompt Info +$CRLF
1:&Yes,True + $CRLF
2:&No,True + $CRLF
3:&Ok,True + $CRLF

I send that string (or something very similar) to populate the form, a label caption and a array of Command Buttons. The form will be a reusable Question Form.

Its powered by a couple of functions:

function QuestionYN$(qData$)
function QuestionYNA$(qData$)
function Message$(qData$)

The buttons are Yes, No, Ok, Yes to All, No To All.  The function return back the Words of the button clicked.

So you can use the function like this..

If QuestionYN$("Are you sure?") = "Yes" Then
do it'..
End if

Or In a Loop you can look for the Yes To All click and stop prompting.. Its a very useful form now that its operational.. ;)