PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → RAD / LinkedForm
RAD / LinkedForm
Débuté par Guenter Predl, 08 aoû. 2004 15:43 - 17 réponses
Posté le 08 août 2004 - 15:43
Hi friends,
these days, I'm doing a lot with RAD. I think, my findings / solutions are generally interesting. This time I fought to make a LinkedForm work. Originally, after RAD-generation it looked like this one:
This form works fine. The correct ingredient number is shown in the called combo and at another form (Matter of contents + Table of ingredients) the correct matter of contents number is shown in its combo. As long as you dont touch the form, everything will work OK.
First change: Fix the RADControlSearch-procedure! After the fix it should look like below. You should add this change to the RADControlSearch.mdl-file in \WinDevUS\Personal\Models\RAD in order to get the right code on every RAD-run!


Very important: Now I applied some changes to the form as you can see below. THE most important change (with a serious consequence!!) was that to change the combo 'Zutatennummer' from a simple combo to a combo with Table in order to not only show the ingredient-numbers but also the names of the ingredients! A look at the changed form:

This type of form (Formular ZUTINH) inputs data into a linked file. In this example, we input data into a file, which holds the type & quantity of matters of content for ingredients to a recipe. The calling Form looks like this one:

As shown, we click on the 'New' button. What we can see is a real surprise!:

Yes, the ingredient number '76' is lost and replaced by a '1'. What happened? We did not change one line of code except that fix of the RADControlSearch, which would have caused a hidden crash on seeing the first edit control.

Yes, visiting the combo box in the initialization phase changed the value of the combo to '1'. We've lost the correct reference to the file!
** To be continued soon! **
Posté le 08 août 2004 - 16:42
Since we lost the value / position of the linked file, we have to save it before initialization of the combo and restore it afterwards.
1 - Add the line: LinkPosition is int to the Global declarations of the window
2 - Save the current position. Let's do that:
Please note, two of the brackets in
LinkPosition = HSavePosition({ExtractString(ExtractString(OpeningMode,2,"="),1,".")})
are indirection operators!
Ok, let's test it now:


Works like we expected it to do ..
** To be continued soon! **
Posté le 08 août 2004 - 19:47
Next, we have to set the edit controls to show us the names of ingredient and matter of content, in case of a Modification, we want to see the initial quantity too:
We're doing this within the procedure ModifWindowMode(..)
Next, just in case the window is in Browse oder LinkedBrowse mode, we have to set the edit controls in the RADDisplay() procedure:

Keep in mind, RADDisplay() displays a record which is already stored in the file. Add these two variables OLD.. to the Global Declarations with their proper type spec. Later, when validating the form, these two are neededto detect, whether a change of one of the key-value happened.
Let's test our form now:

Under all circumstances, we can see the combos and edit controls filled properly.

An additional information, showing part of the analysis pertaining to the three files in question:


** To be continued! **
Posté le 08 août 2004 - 20:44
If using one of the Vision-Buttons or if we select another item from the combo-boxes, we have to provide code for showing the correct descriptions.
At first both combos:

Next, both Vision-buttons:


An additional information, showing the Form with its control-names:

** To be continued! **
Posté le 08 août 2004 - 22:59
Generally, the form's now working like it should. In Creation, Browse and Modif mode. The last thing missing is VALIDATION, because we have no protection against input of already existing key values. Additionally, we have to look, whether the field Menge (='Quantity' in units of measurement) has been filled in.
1) Insert a new local procedure: ValidateRecord
2) Add a new integer to Global Declarations:
SavePosition is int
3) Call the procedure ValidateRecord from RADRecord()

4) First check: we add a simple range check for both key values to ValidateRecord:

5) Next, for Creation mode, we look into the file for a record with these two key values alredy in place:

This way, we can prevent an error-window from the file-system plus, we can tell the user what's wrong. Sorry for the German error-messages! I hope, everybody does understand what's done here anyway ..

6) In Modification or Browse-Mode, we have to check first, whether one of the two keys changed (comparison of the OLD..-values with the actual values to be stored in the file) and if, whether such a key-combination is already in the file. After all, somebody fiddled with one of the combos, but actually did not change its value or only the quantity had been modified.

7) At last we check, whether the quantity has been filled in. The closing RETURN is just for my own understanding, the procedure would RETURN without the command too.

*** THE END ***
Posté le 09 août 2004 - 15:36
hi Guenter,
i made similar experience, even sometimes when going from a table (with a selected line/record) to a form containg combos. --> filling the combo sets the file pointer to first record ? In such cases i read the concerning record again - i think the same effect as you did with save/restore position)
furthermore i think this RAD-generated browse/edit forms ar a bit overloaded with code. Sometimes it's not easy to decide where to put the own code
In my apps i rather separate browse and edit in two different windows.
By the way, how do you manage to write (draw ?) in your screenshots ?
I could use that for screens in the manual/help files.

heinz
Posté le 09 août 2004 - 19:49
hi Guenter,
i made similar experience, even sometimes when going from a table (with a selected line/record) to a form containg combos. --> filling the combo sets the file pointer to first record ? In such cases i read the concerning record again - i think the same effect as you did with save/restore position)

Hello Heinz,
one small point: You cannot re-read the record because the file pointer has been changed already during the initialization process of the combo. You have to catch the correct data before and preserve it during the init process. Theoretically, my code for this could be added to the RAD-model-code. I'm not yet sure, whether this would show up in the code of all generated window-types or just in these linked Windows and whether it would disturb a 'normal' window. This is research in progress

>furthermore i think this RAD-generated browse/edit forms ar a bit overloaded with code. Sometimes it's not easy to decide where to put the own code
Yes. The purpose of my series has been to show where the custom code should go and which peculiarities to observe when inserting code.
Keep in mind: Cutting thirty windows from scratch is hard work, but it can be done. My new project counts about 300 windows after a full app RAD and will have about 500 windows when finished. Yes, quite a number of them will be 'custom' made, but for the majority I can use those generated windows - provided their adaption can be done on a common plan. What you've seen in my postings: this is the plan.
RAD code is overloaded just because of one reason: You'll find exactly the same code in each and every window of the same type. Our French friends have tried to take care of quite a number of possible situations. In a higher sophisticated generator (than RAD), they would take care of all the validation and would end up with a fool-proof window. But RAD doesn't do that. RAD code automates several types of windows and that's it. It doesn't safeguard the user from error situations like inputting duplicate key values into unique key fields, the combos are without associated edit/static in order to show the combo value. Btw, I'd appreciate to see the chosen Table row of the combo in the combo! Something like [ 1 | Raw fish ]. Of course, one can simulate this behaviour with a composite key, a trigger could take care of building the key.
In my apps i rather separate browse and edit in two different windows.

We really would like to see alternative concepts of user interfaces! You're heartily invited to post the images of some windows and show us the mechanics of them.
By the way, how do you manage to write (draw ?) in your screenshots ?
I could use that for screens in the manual/help files.

heinz

Screenshots are taken and edited with Capture Professional from http://www.creativesoftworx.com. Nice tool.
Best regards,
Guenter
Posté le 09 août 2004 - 21:40
heinz
Screenshots are taken and edited with Capture Professional from http://www.creativesoftworx.com. Nice tool.

Best regards,
Guenter

Another option is Snagit from www.techsmith.com - I use it a lot, good set of tools - what I cannot do is figure out how to get any screenshots onto this forum - Any clues Guenter
Regards
DerekT
Posté le 09 août 2004 - 21:50
Hi Guenter
Thanks for the 'unofficial' training courses - some useful insights and workarounds
What surprises me is that you with your extensive knowledge of WD are now favouring using RAD and then correcting it!!!
Having myself used RAD to learn a lot of what happens within WD now find it easier to start with a blank screen and build the functionality I require
To this end I now have a library of code snippets ---- would be nice if WD provided a cut&paste code library function ---- plus exported screen templates
Maybe I will revisit RAD
Regards
DerekT
Posté le 10 août 2004 - 09:39
Hi Guenter
Thanks for the 'unofficial' training courses - some useful insights and workarounds
What surprises me is that you with your extensive knowledge of WD are now favouring using RAD and then correcting it!!!

As I've written yesterday, one can make a project with 30 windows from scratch, but not a project with 300-500 windows. I HAVE to be ready with that at the end of August 2004, I started to code in July 2004!
I think, the user interface as designed by PC Soft is excellent, so why not use it? Yes, it has some flaws, but we can fix them. Think: I would have to manually create, name and place several thousand buttons alone, not to talk about several ten-thousand controls. I would have to write the core mechanism of the Forms each and every time!
No, let RAD do it first and we'll fix the generated windows, that's easier and faster. Currently, RAD cannot do validation - a user inputting a duplicate key value is not warned, not guided back to the offending control, s/he's just getting a very cryptic error window. Looks nice but says nothing to an end user. We will see automatic validation routines as soon as the UML diagrams are used for interface and code generation.

Having myself used RAD to learn a lot of what happens within WD now find it easier to start with a blank screen and build the functionality I require
To this end I now have a library of code snippets ---- would be nice if WD provided a cut&paste code library function ---- plus exported screen templates
Maybe I will revisit RAD
Regards
DerekT

Of course, I'm able to build from scratch any window you want. Even those looking like the CRM example. But doing so my project would be ready in about August 2006. I'm only getting 18.500,- Euros for this project and it has to be finished and working in the first days of September 2004, just because my customer will start production in their new production facilities, which are presently under construction. That's the job to be done and compared to it RADRace is a child's play.
What we need are fool-proof windows from RAD. Working excellently without any code fixes, validation to add or any visual touch up needed. Cant be, RAD's delivering combo-boxes with numbers in them only, no description, nothing. But I think WD9 will start with this, let's see ..
Regards,
Guenter
Posté le 10 août 2004 - 10:02
heinz
Screenshots are taken and edited with Capture Professional from http://www.creativesoftworx.com. Nice tool.

Best regards,
Guenter
Another option is Snagit from www.techsmith.com - I use it a lot, good set of tools - what I cannot do is figure out how to get any screenshots onto this forum - Any clues Guenter

Regards
DerekT

Hi Derek,
there are two ways:
1) Upload the images to your web space and reference them in your posting as an html-image: img src=.. - the easiest way. If you 'respond' to one of my postings with image, you can study the format. You should take care to keep the image for some weeks on your web space.
2) Send me your image by mail to gpredl@syspredl.at and I will upload the image either to the parsimony space or to one of my web sites. Later, you can reference that image either under
http://bilder16.parsimony.net/forum28986
OR under an address I will tell you by e-mail.
This will take some hours, because I'm not always in the office.
3. If you do not have web space available, there are some offerings for FREE web space. Take care that you are allowed to reference images on this web space from outside. Have a look at
http://marmo.www.50megs.com/
http://www.freepage.de/index.shtml
http://www.fortunecity.de/join/step_1.html

Best regards,
Guenter
Posté le 10 août 2004 - 22:24
Hi friends,
these days, I'm doing a lot with RAD. I think, my findings / solutions are generally interesting. This time I fought to make a LinkedForm work. Originally, after RAD-generation it looked like this one:

This form works fine. The correct ingredient number is shown in the called combo and at another form (Matter of contents + Table of ingredients) the correct matter of contents number is shown in its combo. As long as you dont touch the form, everything will work OK.
First change: Fix the RADControlSearch-procedure! After the fix it should look like below. You should add this change to the RADControlSearch.mdl-file in \WinDevUS\Personal\Models\RAD in order to get the right code on every RAD-run!


Very important: Now I applied some changes to the form as you can see below. THE most important change (with a serious consequence!!) was that to change the combo 'Zutatennummer' from a simple combo to a combo with Table in order to not only show the ingredient-numbers but also the names of the ingredients! A look at the changed form:

This type of form (Formular ZUTINH) inputs data into a linked file. In this example, we input data into a file, which holds the type & quantity of matters of content for ingredients to a recipe. The calling Form looks like this one:

As shown, we click on the 'New' button. What we can see is a real surprise!:

Yes, the ingredient number '76' is lost and replaced by a '1'. What happened? We did not change one line of code except that fix of the RADControlSearch, which would have caused a hidden crash on seeing the first edit control.

Yes, visiting the combo box in the initialization phase changed the value of the combo to '1'. We've lost the correct reference to the file!
** To be continued soon! **

That's a great 'style', Günter. I do like it very much. Martin are going to translate 'your style' in the Dutch language and I will ask him for the result of his work followed on your work. You have airco in the office or do you made this stuff in those tropical degrees?
Regards, Teun from Holland with a better temperature now.
Posté le 10 août 2004 - 23:58
That's a great 'style', Günter. I do like it very much. Martin are going to translate 'your style' in the Dutch language and I will ask him for the result of his work followed on your work. You have airco in the office or do you made this stuff in those tropical degrees?
Regards, Teun from Holland with a better temperature now.

Teun, please note: The 'style' (= template) is different to the automatic translation program, which I offered for download. The style is a modified '80 System' template. I've modified just the font / font size, the button sizes and most other controls in order to show the bigger characters. My programs go into production environments and 8pt/normal texts could not be read.
The '80 System' template reflects the current XP theme. So, get some theme management tool like XP style and download some of hundreds of themes from the web. Each time you're changing the theme, your application will look different. Since all the colors are manageable from outside the application, as a user, you can make 'your' application. Applications can have a different look on each computer in a network. If you want to save the work, I'll send it by mail to you. Warning! It will replace the '80 System' template, it's not a new template!
The translation program translates the model files (*.mdl in \RAD) completely. After translation, all buttons, messages etc will show up in the translated language after RAD - no English words anymore!
Yes, it's kind of warm but not really hot here. In my office, there are 26°C right now, without air condition. I had to close the window, because it has about 22 outside now and that's a bit too cool for me. During the daytime it's never more than 27°C in the office, it's looking north-east. Outside, there had been about 32-33° today. Tomorrow will be rainy, they say and the temperature will go down a bit Austrian weather
Good night!
Guenter
Posté le 11 août 2004 - 00:26
> My programs go into production environments and 8pt/normal texts could not be read.
That's my problem too
If you want to save the work, I'll send it by mail to you.

That would be veeeeeeeeeryyyyyyyyyy nice. TIA.
> Warning! It will replace the '80 System' template, it's not a new template!
That's not bad, that's the intention.
about 22 outside now and that's a bit too cool for me.

You like hot weather? I like the Dutch way : sometimes hot, sometimes warm, sometimes cold and dry, sometimes cold and raining, sometimes freezing, etc. always different. But I like 20°C : that's warm enough for me.
>Good night!
The same to you.
Guenter

Kind regards, Teun
Posté le 11 août 2004 - 03:27
A little surprise to me: There are cases, where this window is called from a Table with "Creation" or "Modif" but without attached file/key name like e.g.
Creation=HSZUTATEN.ZUT_NUM
Calling without attached file/key name, a simple "Modif" or "Creation" as contents of OpeningMode has the purpose to NOT grey one of these two combos and allow input / change of both combos. The Position(OpeningMode,".")>0 makes sure, there is an attached file/key name to "Modif" or "Creation". Otherwise we do not need to store the position.
Posté le 13 août 2004 - 10:15
Günther,
> THE most important change (with a serious consequence!!) was that to change the combo 'Zutatennummer' from a simple combo to a combo with Table in order to not only show the ingredient-numbers but also the names of the ingredients!
Just a question of understanding: Why would you want your customers to see and even manipulate the internal 'automatic ID' of your ingredient file? Is anybody interested in ingredient **numbers**?
Why don't you show the ingredient name instead of the number even if you store the ingredient number in the receipt file? This is somehow related to my question regarding the use of combo-boxes, isn't it?
regards
Ludwig
Posté le 13 août 2004 - 12:11
Günther,
THE most important change (with a serious consequence!!) was that to change the combo 'Zutatennummer' from a simple combo to a combo with Table in order to not only show the ingredient-numbers but also the names of the ingredients!
Just a question of understanding: Why would you want your customers to see and even manipulate the internal 'automatic ID' of your ingredient file? Is anybody interested in ingredient **numbers**?

Hi Ludwig, there's NO automatic ID in my files. Since WinDev Hyperfile can automatically change keys in related files, the need for an 'independant' link between files is null. Formerly, when this ability did not exist (WD5.5), the automatic ID had been a way to link files in a way hidden from the user. So, this number is input by the user!

Why don't you show the ingredient name instead of the number even if you store the ingredient number in the receipt file? This is somehow related to my question regarding the use of combo-boxes, isn't it?
regards
Ludwig

For a long time now, we rely on a single unique identifier of an item: its number. Staying with ingredients: There are so many ingredients with similar names and similar purpose, it's inviting trouble to rely on names only. Many of my customers are using our applications for more than 20 years and frequently know the numbers (items, ingrediends, their customers etc) by heart. Letting them work with names is unthinkable.
Regards,
Guenter
Posté le 13 août 2004 - 12:55
Thanks for your explanation, now I understand the situation better.
Could you expand a bit on how you link files without an 'automatic ID'? Are you storing the actual data in both files? And how does WinDev Hyperfile automatically change keys in related files? It would have to touch every single record, wouldn't it?
best regards
Ludwig

Hi Ludwig, there's NO automatic ID in my files. Since WinDev Hyperfile can automatically change keys in related files, the need for an 'independant' link between files is null. Formerly, when this ability did not exist (WD5.5), the automatic ID had been a way to link files in a way hidden from the user. So, this number is input by the user!