Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 6 Jahren, 7 Monaten
Letzter Beitrag:
vor 6 Jahren, 7 Monaten
Beteiligte Autoren:
Joris, Jose Antonio Garrido, jose antonio garrido, DerekT

How to know the controls on a TAB in a MDI window?

Startbeitrag von Joris am 28.11.2011 09:58

Hi,

Can anybody help me with this issue?

I have a window with a TAB control on it that contains serveral controls (Edit fields, Comboboxes, checkboxes etc). I have paced a 'Reset' button on it. The purpose of this button is to empty every control on the TAB. I have made a procedure that can do this, the only thing is that it does not work when the window is opened in MDI (MDIOpen). The EnumSubElement instruction does not return any control name in that case.

Thanks for helping,
Joris.




PROCEDURE ResetZoekVelden(PsParent)
LsControlName is string = EnumSubElement(PsParent,enumFirst)
LsFullName is string

WHILE LsControlName ""

LsFullName = PsParent + "." + LsControlName
SWITCH {LsFullName,indControl}..Type
//Edit veld
CASE typText, typDate, typDuration, typTime, typCurrency, typNum
{LsFullName} = ""
ExecuteProcess(LsFullName,trtExit)
//Combobox
CASE typComboNE, typComboWE
IF ListCount(LsFullName) > 0 THEN
ListSelectPlus(LsFullName,1)
ExecuteProcess(LsFullName,trtSelection)
END
//Checkbox
CASE typCheckBox
{LsFullName} = False
ExecuteProcess(LsFullName,trtChange)
END

LsControlName = EnumSubElement(PsParent)
END

Antworten:

Hi. I think that enumsubelment in tabs must be use different. Here is the syntax (copy & paste from the help)

By default, EnumSubElement used on a tab enumerates all the controls found in all the panes without displaying the pane.
When the enumPane constant is specified, EnumSubElement used on a tab enumerates all the tabs (but not the controls found in the tabs). The result has the following format: "" where is the tab number. To find out the caption of the tab, use ..Caption.
To enumerate the controls found in each pane, an enumeration must be performed on the pane from its number:
EnumSubElement("..")

von jose antonio garrido - am 29.11.2011 00:45
Thank you for your answer. But I don't think this is the problem. The code works if the window is opened with the open command.

My question is : What should I pass as Element name when the window is opened in MDI? When I pass the Alias name of the window then the result is empty

Thanks,
Joris.

Result = EnumSubElement(Element ,Option)
--------------------------------------------------------------------------------
Result: Character string
Full name of the element found (Window/Page Name.Control Name for example), empty string ("") if no element was found.
Element: Character string (with quotes)
Full name of the element to enumerate. For a control, this parameter has the following format: Window/Page Name.Control Name ("MyWindow.MyTable" for example).
Option: Optional constant
Parameter that must be specified during the first call to the function (to start the enumeration). This parameter is not required to continue the enumeration.


von Joris - am 29.11.2011 08:58
Joris
Have you tried using the window name?

This cane be obtained from the alias using indirection - {AliasName,indWindow}..Name

von DerekT - am 29.11.2011 09:36
Hi.

I have check this syntax and works perfectly.

scontrolname is string = EnumSubElement("WIN_NoName2.TAB_NoName1.2",enumFirst)
trace (scontrolname)

WIN_NoName2 is a child window opened with MDIOpen.

Didn't try yours because so many lines.

José antonio.



von Jose Antonio Garrido - am 29.11.2011 15:54
Thank you both for helping.

Indeed, my mistake was to pass the full name of the TAB (TAB..FullName) instead of the window name and tab name. :rolleyes:

Kind regards,

Joris.

von Joris - am 29.11.2011 16:13
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.