Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
2
Erster Beitrag:
vor 6 Tagen, 13 Stunden
Letzter Beitrag:
vor 6 Tagen, 13 Stunden
Beteiligte Autoren:
Fabrice Harari, DerekT

Dynamic Tabs & Window identification

Startbeitrag von DerekT am 10.08.2017 14:15

WD22

Thought I would bring myself up to date so the application I have is based on dynamic tabs - I like them and it does look good but I seem to have dug myself a bit of a hole.

Tab 1 opens and contains a table control listing, in this example, Properties.
Double clicking on a row opens, on a new tab, a detail (form) window with the full record content.
To take advantage of the dynamic tab approach multiple detail windows can be opened although I am limiting this to 3.
This is all operating fine - happy days.

An 'update form' window (on its own dynamic tab) can be called from either the table or detail window of a given record and this is where my problem starts.
What I want, indeed need, to do is keep the displayed data in both windows in sync.

If the edit is called from the detail window then all is good as the table is common to all detail windows -- On saving the edit window closes, the detail window refreshes itself and then calls the refresh procedure for its parent table.

If however the edit is called from the table window it can only refresh itself as I can find no way to run the update procedure on a specified window.
To manage Dynamic tabs does require an array but the only information I store that is unique to the window itself, not the record displayed, is the alias of the its tab and its System Handle ID -- Sadly neither of these pieces of info can be used to execute a procedure -- That requires the window name which in this case is identical for all 3 detail windows.

So I'm asking here, more in hope than expectation, if anyone can maybe offer a possible solution.

To save wasting peoples time I would add....
I did think that I could wait to refresh the detail window until the user returned to that specific tab by setting a flag somewhere.
Unfortunately that failed as it appears that each tab exists in its own private world as no code is executed when the tab content is re-displayed - it does not even fire the 'OnFocus' event.

Now this is WinDev so of course there is always a way to achieve what is required and I have indeed got a solution.
On saving an update I populate a global variable with the System Handle of the window.
Every detail window which requires this 'sync' functionality now runs an 'Automatic Procedure' that continually runs while the window is open - this compares the handle of its host window with the global variable -- If the same, bingo, the update procedure is executed.
What I am not keen on is that, according to the Task Manager each window open that has the automatic procedure is consuming an additional 1.5 to 2.5MB of ram.
I have 7 windows with a table control so potentially 21 detail windows could be open at any one time.
Put on a server with 50+ users then that potential total obviously increases.

So my second question is am I being overly pessimistic with regard to consumption of the system resources?

Antworten:

Re: Dynamic Tabs & Window identification

Hi Derek,

There may be some twist because of the dynamic tabs part, but I have managed this kind of things quite easily before in free windows. The trick is to use NOT the window's NAME, but the window's ALIAS that is unique and defined when opening the window (see help on opening windows for details).

At this point, you just keep an array with the window alias and your logical information (file, record, or whatever you need) and you are in business.

I'm doing something like that in WXEDM, if you want an example.

Best regards

von Fabrice Harari - am 10.08.2017 14:52
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.