Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 8 Jahren, 11 Monaten
Letzter Beitrag:
vor 8 Jahren, 10 Monaten
Beteiligte Autoren:
Ola, DarrenF

Files and key names in window templates?

Startbeitrag von Ola am 30.07.2009 22:34

WD's full RAD seems to be still in a development stage, so maybe I should first investigate the separate window template feature.

It looks simple and easy, except for the file and key names, and the population of the fields.

1) How do you handle file and key names in window templates?

2) How do you populate a template based window with the file items?

Thanks in advance for any hints and tips.




You're absolutely correct - it is definately a "work in progress" for PC Soft I think!

I've asked many questions on this forum about full RAD and soon came to conclusion that templates were the way I needed to go if I wanted to start working...

In answer:

1) I think indirection is your answer here - especially if you have the time up-front to get it all working (I didn't have that luxury).

2) Not high-tech, but I drop the controls on the window and I'm using code bricks to hold the code for the different events that I use in my solution. If you keep it simple(ish) then this works quite well (for me at least).

Hope this helps...


von DarrenF - am 31.07.2009 11:38
Thanks Darren,

Thats what I figured, too. Define the file and key names as string variables and then use them as such or via indirection where necessary.

But how do you give values to these variables in a template generated window, when you can't get inside the template code, and even the local procedures can't be overloaded (which is a bad drawback being hauled from version to version...)?


von Ola - am 31.07.2009 13:04

I don't worry about putting too much into my templates. I have standard buttons for things such as New (add a new record), Save (save record being amended), Delete, Close, Page Up (in a table), Page Down, First, Last, Print and I have a bit of standard code for setting the Window Title based on the name in the window properties and that's more or less it.

Then for each of the above buttons (aka events), I have a code brick and the code bricks are based on a sample table, lets say Tax_Types (which was the first window I developed from scratch and thus based my templates on it), and as I include the code bricks, I manually change the table name to the current window (WD is kind enough to put little light bulbs in your code indicating where the changes/errors are :spos:), and if you use screentofile and filetoscreen you don't need to worry too much about individual assignment statements in your code. Obviously, this is VERY clunky, but I had to get going! ;-)

Doing it this way, I can develop a new maintenance screen in 10 or 15 minutes - it works for me!

I suppose equally, instead of code bricks you could have standard blocks of code in each of the events (as a reminder), that are commented-out and just remove the "//"s to start using it :spos:


von DarrenF - am 31.07.2009 13:26
Thanks Darren,

I have now done a couple of windows based on templates and noted that there is a good place to embed own code and give values to variables in between the template code, in the windows's global declarations. There it will be embedded between the template's global declarations and the template's initialization code.

For "code bricks" I am using a separate text editor, "Notetab Light" (freeware, one of my favorite pieces of software), where I can keep several text files open at the same time. For complete, variable-driven "button bricks" I am using a separate "storage window".

The weak point in the window templates is really the lack of sufficient number of code embed points, which somewhat limits their useability or makes them unnecessarily difficult to use:

- In buttons code can be added before and after the button code, but not in between.

- The greatest lack is that code cannot be embedded in the local procedures at all!!! This is a real pain. Perhaps this can be overrun by adding into the template code calls to invisible buttons, where code can be added as needed, or calls to global procedures with the window name as parameter...

- Another lack is that any "extra" visible buttons, such as link buttons to relation forms or tables, cannot be placed to a template, because they cannot be removed from the window, if not needed. Or perhaps they could be used as invisible and then turning their visibility on in the window initialization code...

- and of course one more major limitation is that parameters cannot be passed to template-based windows, so they must be controlled by using global variables.

So many limitations, so many questions, so much testing to do...


P.S. "Template" here refers to the separate window templates, not to WD's full rad pattern system templates, which are a totally different beast (they are one-shooters only, no good IMO).

von Ola - am 02.08.2009 18:03
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.