Welcome! Log In Create A New Profile

Advanced

Add/Modify mode...

Posted by DarrenF 
DarrenF
Add/Modify mode...
October 28, 2008 03:45PM
Hi all,

I'm creating a add/modify/delete maintenance window... could someone remind me how to find the current mode of a window, i.e. the add or modify modes - I've read it somewhere but can't put my hands on it?

Thanks...
Erisa.pcs.crosspost
Re: Add/Modify mode...
October 30, 2008 11:02AM
If you use Form created by windev prototype then you should have in the Global Declaration Section of your form an variable which show in what mode are. This variable is "WindowMode"

Message forwarded from pcsoft.us.windev
Peter Holemans
Re: Add/Modify mode...
October 30, 2008 12:46PM
MyWindow..NewRecord will do the job.

Cheers,
DarrenF
Re: Add/Modify mode...
October 30, 2008 03:27PM
Thanks for your response, and sorry for my ignorance... which prototype are you talking about here?
DarrenF
Re: Add/Modify mode...
October 30, 2008 03:30PM
Peter,

I think your suggestion will tell me if a record has been created or not, but I suppose what I'm asking is how do I know if I've got currency/persistence on a record or not which would tell me I'm in Modify mode otherwise I'd be in Add mode :confused:

Hope this makes sense...
DarrenF
Re: Add/Modify mode...
October 30, 2008 04:24PM
Ah - I see what you mean Peter :spos:

This is the code from the RAD:

// If it's a new record
IF RADFileA..NewRecord = True THEN
	// Add it
	HAdd(RADFileA)
ELSE
	// Modify it
	HModify(RADFileA)
END

I'm trying to code it before the event... whereas the RAD example decides at the point of the actual Add/Modify action...

I'll look into this...

Thanks.
Al
Re: Add/Modify mode...
October 30, 2008 09:24PM
Hello Darren

There is no inbuilt Windev function to tell you what you want to know. You have to manage it yourself in the call to the window as a parameter. The RAD code does this by setting up variable to do it but if you are not using RAD then you will need to create your own

You will need a CalledMode and a CurrentMode variable
The old RAD used "Creation", "Browse" and Modify as the values for these parameters so you could test the value of CalledMode to know the mode when the window was opened and CurrentMode to see see if the initial mode had changed.

e.g. Open(WindowName,"Creation")
In the window that is being called
Procedure Form(CalledMode = "Browse") //default called value

If the user clicks on the edit button or modifies a control
CurrentMode = "Modify"

At the point of saving the record
If CalledMode = "Creation"
HAdd()
else
Hmodify()
end




Regards
Al
DarrenF
Re: Add/Modify mode...
October 31, 2008 12:27AM
Thanks Al,

I was beginning to think that... but just wanted people's thoughts and any techniques on the matter - all discussions and thoughts are gratefully accepted:spos:

Cheers guys...
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: