Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Woche, 3 Tagen
Letzter Beitrag:
vor 1 Woche
Beteiligte Autoren:
Tor-Bjarne, Steven Sitas, GuenterP

enum problems with dynamic Tabs

Startbeitrag von Tor-Bjarne am 15.05.2017 08:49


WinDev 21

I Decided to write my own groupware class as I want full control and have another approach to User and Passwords in my project.

A small example is when starting the application users are auto-logged on as "User" (or whatever) and require a Logon with a user with Admin rights to set attributes of a window and it`s controls.

BUT I have a couple of problems/challenges.:

1. I use a dynamic tab and I cant enum the controls on this TAB easy, the error suggest I use an ALIAS, but if I use a alias i get a error "unknown control".

2. Why is not menus and pop-up menus showing up, when I enum a window for all controls.

Do anybody have code to share for enum a dynamic tab`s controls (as this is the most important task) I`m willing to pay for this as I`m now pretty tired of trying different enum variations (that fail with dynamic tabs)



Hi Tor,

Why would you want to DIRECTLY enum the controls of a dynamic tab ?
Since dynamic tabs are constructed with Internal Windows, you just need to enum controls of the Internal Windows.

1. Create an associative array (or any array that suits your needs) and in this array keep:
a. the Alias of the created tab pane (returned from TabOpen)
b. the Name of the internal window used in TabOpen

2. Now to control user access in a dynamic tab control, you can use the alias and retrieve the Name of its Internal window and so on ....

Steven Sitas

von Steven Sitas - am 15.05.2017 11:12
Hi Steven, thank you for your reply.

Steven Sitas
Why would you want to DIRECTLY enum the controls of a dynamic tab ?

My wet dream is a class I can drop in any project, that activates my groupware without any hassle.

Now if I need to start dealing with what alias is returned from tabopen I need to edit the "Drop-class-to-project" code, if I want to give the class to someone (say this forum) - I need to explain that they need to use my method "this and that" to save the alias for a dynamic tab so my other method which they have to execute/code can enum the internal window.

Actually I`ve solved the enum of dynamic tabs and are now able to enum the controls on a dynamic TAB directly from the class, now I`m struggling hard with reading the dashboard`s that resides on 3 of my dynamic tabs (also containing alias and internal windows).

My idea of this class is to read the controls visible right now, and check if a disabled or invisible state is saved on these controls (only saving disabled controls).

I also made 2 Hot keys (F11 and F12 - that can be changed with a class proerty) defined in the class.

F11 = Logon screen
F12 = User/Groups management and setting the rights of groups for the window being watched/opened in the moment.

User can change level to Admin without having to start/re-start the application just by Pressing F11 and enter his credentials.

that`s why :)


von Tor-Bjarne - am 15.05.2017 20:52
Hi Tor-Bjarne,

User rights and passwords are a "nightmare" in every Business Application.
Great news, if you have solved it with one class !!!

By the way, PCSofts implementation is way to complicated ....

Steven Sitas

von Steven Sitas - am 17.05.2017 08:39
Hi Tor-Bjarne,

just a hint: look into the enums in PC Soft's Groupware. They enum everything, even components. I don't know about dyn. Tabs but just for fun I'd copy the project as a test project, try to add PC Soft's Groupware and look whether and how they enum them.

von GuenterP - am 18.05.2017 05:14

@Steven - Yes,I`ve tried PCSoft`s approach, as an example if a superuser(not me) disallows a window from being opened and a user try to open it the app gives an exception - No luck when trying to catch the exception and continue with only a "Not allowed" message.

I my more simplistic approach a "User" can change to "Admin" for a short while removing or giving access to a control, without re-starting the app.
(also planning a timeout, logon as std user again if nothing happens on the keyboard/mouse for minutes)

@Guenter - Yes i do :) - now I found that it seems in some instances the gpwEnumcontrol do not work:

fld is string =EnumControl(Formname, ncontrolcounter) //fld contains a control
dd is string = gpwEnumControl(FormName, nControlCounter) // dd contains ""

But what has tricked me is that the ReadTabs (of a dynamic tab or a dashboard) probably needs to be recursive, as the "TAB 1" can contain a new tab, but I very fast lost track of what level I was in the recursive code.

Then I popped and pushed an integer variable to use in the trace to tell me in what level I was but felt that it was getting to complicated to follow and if I`m to give away the class (if anybody wants it) I made a different approach simulating recursive reads of sub-elements/childs.

An example: (The controls are temp stored in a array of STControl structures)

The code adds controls to the array, and if it hits a container it just set a flag (Container = 1), the code below runs until all containers bContainer_read = True, since it`s a Loop DO While the check on nCounter1 is at the end (runs 1 time minimum)


nCounter1 is int

nCounter1 = 0
FOR EACH DS OF ::Controls
IF DS.sControlName = "" THEN
IF DS.bIS_container AND DS.bContainer_read = False THEN
MyTrace("Reading unhandled container '"+DS.sControlName+"'")
CASE 9 // Table
CASE 87 //Ribbon
CASE 16 //Tab - dynamic or not
CASE 29,40 //Container
CASE 31 //Internal window
CASE 111 //DashBoard
MyTrace(DS.sControlName,::GetControlType(DS.nType),"is this a container ? (anyway not handled.)")
DS.bContainer_read = True
MyTrace("Skipping: ",DS.sControlName,DS.sCaption)
DO WHILE nCounter1 > 0

Well still work in progress - I need this for a couple of projects of my own. :-)


von Tor-Bjarne - am 18.05.2017 18:55
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.