Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 9 Monaten
Letzter Beitrag:
vor 1 Jahr, 9 Monaten
Beteiligte Autoren:
DerekT, Steven Sitas, Alexandre Leclerc, GuenterP, Fabrice Harari, Markus K.

More dynamic tab woes

Startbeitrag von DerekT am 06.10.2016 18:50


I have a dynamic tab display a table control.
Any record selected in the table can open a detail window in another tab - multiple records can be displayed in this way.

Each detail window allows me to edit the record following which I update the information displayed on that window and refresh the data in the table

So far so good

What I also wanted to do is to be able to update a record directly from the table.
No surprises in that I can do this without any issues.

The issue arises however because I want (need) to update the information displayed in the corresponding detail window.

I can identify (retrieve) the alias of the window I'm interested in however WD does not allow me to make use of this to select the window and run a local update procedure.

I can of course run the procedure but it is pretty much 'pot luck' as to which of the detail window are selected.
I can tell after event as for some reason the tab of the random window processed become active.
I had hoped for something as simple as 'DynTab[ALIAS_1].WindowName' - Sadly not.

Not only is this annoying but it effectively renders the app useless as none of the arrays, variables I use to control the process are updated.

Absolute crock - means that all tabs, if opened multiple times, are effectively read only.

If I do not lose the will to live I may send PCS a project - sadly my experience in the respect has always been disappointing.


Hi Derek,

did you try with indirection?

Best regards

von Fabrice Harari - am 06.10.2016 18:54
Hi Fabrice

Yep, tried indirection without success.

The issue is that dynamic tabs are, by any other name, internal windows which reduces somewhat the actions that can be taken with them.

The only identifier for any window is the WD generated alias which as far as I can see is only, can onl be, used to identify/select a given tab.

I have now reverted to checking each detail window for changes when it is next selected and updating the display as necessary.
That seems to work OK and does have the bonus of avoiding WD selecting a different tab.

There's always a plan B:eek:

von DerekT - am 06.10.2016 19:15
Hi, yes, internal windows have some peculiarities when referencing controls from the iw outside of the iw and when referencing controls on iw from the outside. With v20 I wasted two days of precious time to straighten that out, not really satisfying. If there's time, I'll try it once again with v21, maybe after the next update is here.

von GuenterP - am 07.10.2016 06:00

to execute code in the tabs i use:

tmpControl is Control

von Markus K. - am 07.10.2016 07:04

Yes, I saw that in the help and even tried it.
Unfortunately 'tmpControl' never received a value always empty - indeed I am not sure what value it should have received.

This however is not the real issue, to explain.....

I open the first window = ALIAS_1 containing a table control.
From this I open 3 windows ALIAS_2, ALIAS_3 and ALIAS_4 - identical other than content.

An action taken on ALIAS_1 requires a procedure to be run on one of the other windows.
I have all the necessary information for each open window held in an array so I know which one should run the process.

The problem is that as each of the other windows are identical other than content the result returned by your code, control name I assume, would be present on all 3.
Therein is the issue - you cannot isolate a control by the alias of its window.

If you have code that disproves this then I would love to see it.
In the meanwhile I have, in good WD tradition, a workaround.

von DerekT - am 07.10.2016 12:00
Hi Derek,

I had the same issue a year and half ago. The Free Technical Support sent me a very simple solution:

ExécuteTraitement( gsAlias+".InternalProcNameHere", trtProcédure )

So you just have to concatenate the alias name of your window (that you received when you created the dynamic tab: gsAlias est une chaîne = OngletOuvre(ONG_SansNom1, "Some title", FI_Interne)" ) with the procedure you want to execute.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 07.10.2016 12:20
Thanks for that - unfortunately does not seem to work for me

//It is possible that the corresponding 'Landlord Detail' window is currently active
//If this is the case then we need to identify it and update the displayed information
IF pnCode = 2 THEN //Only for record updates
s_Alias is string
lsSeekNdx is string = StringBuild("IW_D_LandlordDetail_%1",gclLandlord.p_clCurrent.m_PK_Landlord)
lnSeekRes = ArraySeek(goApp.arr_DynTabArray,asLinear,"s_SeekNdx",lsSeekNdx)
IF lnSeekRes > 0 THEN
s_Alias = goApp.arr_DynTabArray[lnSeekRes].s_TabAlias
wsAlias = StringBuild("TabOpen(%1,%2,%3)",s_Alias,"""Test Title""","IW_D_LandlordDetail")

ExecuteProcess( wsAlias+".lpRefreshDisplay", trtProcedure)

wsAlias = "TabOpen(ALIAS_2,"Test Title",IW_D_LandlordDetail)" after Stringbuild()

Runtime Error states...
Error at line 62 of Request for refreshing the display of IW_B_LandlordBrowse process.
ExecuteProcess function called.
The 'TabOpen(ALIAS_2,"Test Title",IW_D_LandlordDetail).lpRefreshDisplay' procedure is unknown.
The 'lpRefreshDisplay' procedure is unknown.

Of course the local procedure 'lpRefreshDisplay' does exist on the window.

I have tried with and without the ')' at the end of the Stringbuild statement and with and without '()' on the procedure name - always the same error.
If you can spot anything obvious please let me know.

von DerekT - am 07.10.2016 13:56
Hi Derek,

We had this type of code in v0.1 of alpha360 erp - but eliminated it in later versions.
And it does work [V21]

Here is the main idea:
1. You have somekind of browse/table window

2. From this window you can "open" edit windows for various records and "embed" in the dynamic tab [using tabopen]

3. You have an associative array that will keep the following:
a) the alias - given by TabOpen ** IMPORTANT
b) YOUR name for the edit window - IWF_something_pk1 where pk1 is the primary key of the record etc

4. Now after you edit DIRECTLY in the table [say the record with pk1], you do the following:
a) Look to see if IWF_something_pk1 is in your array
b) If it is, GET the ALIAS and use it in the way Alexandre posted.

Just make sure you call your code, in
// it means that the internal window has been removed from the Dynamic TAB
// and your array doesn't know it

**** Important thing *****
Do a complete compile before running your code.

Steven Sitas

von Steven Sitas - am 07.10.2016 13:58
Yes, this is pretty much what I am doing - see my code snippet in response to Alexandre's post.
Only real difference is that you are now using an associative array which on its own make no difference.

Maybe it is me - looked at it for so long I am seeing what I expect to see.

I did change the 'ExecuteProcess()' to perform a trtClick o a button I placed on my detail window.
Only difference was that the error now reports that the button is unknown.

A bit frustrating as the structure of the 'ExecuteProcess()' string displayed in the error is exactly as I would expect and appears, to me anyway, syntactically correct..

von DerekT - am 07.10.2016 14:38
Hi Derek,

I think I see where you problem is now ...
Let me do some naming so I can explain.

1) Your Browse/Table is called WIN_Browse
2) Your Edit window - the internal one - is called INW_Edit

3) You call as many time as you want the INW_Edit from your Browse, you embed it in your Dynamic tab and you know/keep the aliases given from TabOpen.
Lets say ALIAS_1, ALIAS_2 etc..

Now how do you call a procedure PR in the ALIAS_1 internal window?
sString is string="ALIAS_1.INW_Edit.PR()"

Do you see the difference with YOUR code?

Steven Sitas

von Steven Sitas - am 07.10.2016 15:00

Success, top man.

Had to remove the () from the procedure name but it does appear to be working.
Need to do more testing but I am hopeful.

I know your a busy man so thank you for your time.

von DerekT - am 07.10.2016 15:52
Hi DerekT,

I'm just checking back this thread. Notice that you try to call your procedure with parameters. This is not the correct way. Check the help: the parameters must be passed after.

It is very simple: ExecuteProcess( your_alias_received_after_opening_dynamic_tab + "." + only_your_procedure_name_you_want_to_call, trtProcedure, param1, paramX)

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 07.10.2016 15:53
Hi Alexandre,
Just looked at some of my code and notes.
Sometimes it WORKS the way you are suggesting and sometimes it DOESNT work.
I don't know why ...

What works 100% is to ADD the WindowName with a dot - between the alias and the procedure name.

I am using the latest (I hope) English v21

Steven Sitas

von Steven Sitas - am 07.10.2016 16:19
Hi Steven,

Indeed it depends of the complexity of the code and the context of execution. If you put the Window name it will work in all context, so you will have no worry anymore.

Best regards,

von Alexandre Leclerc - am 07.10.2016 17:03

Re: More dynamic tab woes - SOLVED

Case closed, thanks guys:cheers:

Bit of jiggery pokery to get the dynamic tab to return to the tab that called the update window but all now working as required.

von DerekT - am 07.10.2016 18:16
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.