Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 8 Monaten, 1 Woche
Letzter Beitrag:
vor 8 Monaten, 1 Woche
Beteiligte Autoren:
Scott Daughtry, Fabrice Harari

Popup form window is blank

Startbeitrag von Scott Daughtry am 10.01.2017 04:42

For this application I have to populate the Table Control via a query instead of the normal 'Browsed File' - I had to do this because I needed the TPLC_ChoosePeriod template from the "WD Full Application" example program.

As soon as I changed the Content from Browsed File to the Query, when I click the Modify button from the Table Window the popup Form Window is blank (to modify the highlighted record displayed in the table).

How do I reactivate the form window to edit the highlighted record displayed in the table again? The WD Full Application example doesn't have a form associated with that table control for me to reverse engineer.... so I am stuck with being unable to edit an existing record via the popup Form window that I can use to add new record(s) into the table

Antworten:

OK - I got the following lines of code to work (i.e. populate the Form window with the same values as the Table Control and then refresh the table control with the modified data):

// Is a row selected?
IF TableSelect(TABLE_Jamietrak)=-1 THEN RETURN

// These two lines are required because I'm using a query to populate the table control
HSeek(Jamietrak,JamietrakID,TABLE_Jamietrak..Value)
HReadSeekFirst(Jamietrak,JamietrakID,TABLE_Jamietrak..Value)

Open(WIN_Form_Jamietrak)

// Refresh the table
TableDisplay(TABLE_Jamietrak,taInit) // taInit was required to make the change visible again


Was this the "WinDev" way of doing this or am I making this harder than it should be? I have zero SQL knowledge so I am stumbling in a forward direction

von Scott Daughtry - am 10.01.2017 05:00
Hi Scott,

it looks like you are using the RAD way of opening forms (ie the form works on the current record of the file, as in 'last read record, and therefore already in the buffer file')...

Therefore, if your table is NOT linked to a file (ie linked to a query, or loaded by programming), there is NO record loaded in the file buffer (or an old one) and you need to read it yourself.

so you will need to do a hreadseek (with the hidentical option) AND test the result, as the data in your table MAY BE STALE. THe hSEEK you are currently using is not necessary.

Personally, I prefer to pass the ID of the record to the form, and let the form do the reading. This way, the same code works from ANY situation, and you can easily open multiple forms on the same file without having to use independent HF contexts.

However, if you prefer to do things the RAD way, you can, you just need to UNDERSTAND how it's working, so that you can manage new cases easily.

Best regards

von Fabrice Harari - am 10.01.2017 11:58
Hi Fabrice,

I will remove the redundant Hseek() function call - it was my first attempt to get the form to populate with the listbox selection, and I was diving into the WD help file I found the HReadSeekFirst() function call.

In this instance, the 'TABLE_Jamietrak..Value' is storing the WD-managed unique number that the TABLE Control is storing..

von Scott Daughtry - am 10.01.2017 14:30
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.