How can I get window type as text string from the enum ?
You can use a helper function with a select case where you return the text for each value.
There is no built-in function for that as far as I know.
thanks Christian
It depends on what string you are looking for. If it’s a string representation of the number, you can use CType
Dim s as String = Str(Ctype(w.Type, Integer))
Greg, that displays the window type as number, what I’m after is the text representing that number and that can’t be done according to Christian ( or not very easy )
Public Function GetWindowType(window As DesktopWindow) As String
Select Case window.Type
Case 0
Return "Document"
Case 1
Return "Moveable Modal"
Case 2
Return "Modal Dialog"
Case 3
Return "Floating Window"
Case 4
Return "Plain Box"
Case ... // etc.
End Select
End Function
E.g. Button1.Pressed
-Event:
MessageBox(GetWindowType(Self))
Yes Martin, I thought we have to do it ourselves…
I used an array like this:
Var ls_windowTypeName () as String = Array ( _
“Document”, _
“Moveable Modal”, _
“Modal Dialog”, _
“Floating”, _
“Plain Box”, _
“Shadowed Box”, _
“Rounded”, _
“Global Floating”, _
“Sheet”, _
“Modeless Dialog” )
thanks to all of you
Greg, this works as well
Str ( integer (w.Type))
This is what you wrote. I figured I would give you this answer because you didn’t specify that you wanted the names and could just as easily been asking for the numbers. Sorry for the noise.
So yea, you’ll need a series of if-thens or a select-case where you return the strings yourself,