Welcome! Log In Create A New Profile

Advanced

[WD20] Is it possible to have the name of a NOT OPENED window??

Posted by DannHCS 
Hi,
I'd like to have the name of a window BEFORE opening it.

I tried with WIN_MyWindow..Name but it gives error.

Thanks,
Dann



Edited 2 time(s). Last edit at 11/23/2017 05:40PM by DannHCS.
Hello Dan,

If you use it in the initialization code of the opening window you use

MySelf..Name or MySelf..Alias

DW
You cant get the windows alias before it exists. Maybe WinStatus() helps you to check if the window is open or not. If opened then you can get the alias otherwise not.
Hi Marcus,

not as far as I know... you need to use "Win_MyWindow" when it's not open yet.

Best regards
Hello Dann

Can you explain the circumstances as to why you need to know the name of the unopened window as that may help with a solution.

Regards
Al
@ Fabrice,
afaik the alias can only be allocated when you open the window. How else should the runtime "knows" how many windows are opened?
Have a look at the mdi tab: Open a tab and the internal window/the tab "gets" his alias. If you dont open the window the window doesnt get a place in the memory and so also no alias.

Greetings
Markus
My intention is to manage a big menu with differents categories of windows, every category is included in a component.
Everytime you choose a category a Looper control of buttons is erased and filled by the buttons that will open the windows.
I manage all this stuff with a associative array of strings including the name of the windows.

My problem is that when i change the name of a window in one of my components, the menu doesn't give me a warning, because the name of that window is in a string ("WIN_MyWindow") and not retrieved by a property of the window (WIN_MyWindow..Name).

I'd like not to change the structure of the menu with associative array, I just want to know if it's possible to have the name of a window before that is opened.

Thanks,
Dann
When i understand you correctly, you have hardcoded the names of your windows into an array. Then you could use the directory in which the windows are located. At the start of your program check the validity of the window names in the array so you get informed when you forgot to rename a windows name.
Dann,

it is possible to get the name even if the window is not open. But only the name as it has in the project, which is your name and may not be a user friendly name. Indeed while a window is not open you you cannot access it to get the Caption or Width or whatever property.

// Enumerate the windows of a project
WindowName is string = EnumElement(enumWindow)
// Browse all the windows
WHILE WindowName <> ""
// Go to the next window
WindowName = EnumElement()
END

When I think about this you could Open() all windows with the code above and when you "detect" in the opening-section of the window that it is opened in this special mode (i.e. setting a global boolean), you can Close() it right away. At that point there is no visible action to the end-user, but you have the ability to get some extra window-info before closing it!
Re: [WD20] Is it possible to have the name of a NOT OPENED window?? - SOLUTION
July 30, 2020 06:03PM
Hi,

as an example:

Trace("-- List of project elements")

ElementName is string
ElementName = EnumElement(enumAll)
WHILE ElementName <> ""
	// EnumRecursive(ElementName)
	ElementName = EnumElement()
	
	IF Left(ElementName,6) <> "Report" AND NOT ElementName = "" THEN
		Trace(ElementName, {ElementName,indGPW}..Text)
	END
	
END

Kind regards,
Guenter Predl
office@windev.at



Edited 1 time(s). Last edit at 07/30/2020 06:04PM by gpredl.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: