Getting Window.Type

Hello,
I’m trying to convert this old program code to API 2. Unfortunately, I’ve failed so far. This code isn’t mine, I’m just trying to make it usable. When I try to replace ‘Window.Frame’ with ‘Window.Type’, I get the error message: ‘Expected Int64, but got enum DesktopWindow.Types’. What exactly am I doing wrong? Does the Windows.Type ‘Modal’ even exist?
Thank you very much in advance for your efforts.

This is the code in question:

Select Case self.Window.Frame
  
 Case Window.FrameTypeModal, FrameTypeModal, Window.FrameTypeMovableModal, Window.FrameTypeSheet, Window.FrameTypeGlobalFloating
  
  Dim u As new UI_PopupMenuModalWindow
  u.Show(X, Y, Height-MyStyle.BorderWidth*2, me, List(), ListIndex, True, True)
  
Else
  
  Dim u As new UI_PopupMenuWindow
  u.Show(X, Y, Height-MyStyle.BorderWidth*2, me, List(), ListIndex, True, True)
  
End Select

This should become

Select Case self.Window.Type
  
  Case DesktopWindow.Types.Modal, DesktopWindow.Types.MovableModal, DesktopWindow.Types.Sheet, DesktopWindow.Types.GlobalFloating
…
End Select

Make sure your window is an API2 DesktopWindow and not an API1 Window.

Indeed, but I think ‘Expected Int64, but got enum DesktopWindow.Types’ suggests that he’s already got a DesktopWindow. I remember getting similar complaints while changing from API1 to API2 when all my windows were already DesktopWindows but parts of the code still assumed API1 windows.

Hi Michael,
I tried your tips and they work. However, the ‘Window.Type.Modal’ doesn’t seem to exist anymore. When I try ‘Case DesktopWindow.Types.Modal’ I still get an error message, but the rest works.
Thank you very much.

Roger

Hello Tim,
thank you for your advice. All my windows are of the type ‘DesktopWindow’.
Thanks.

Ah, sorry, make that ‘DesktopWindow.Types.ModalDialog’.

The types of DesktopWindow are

Document
MovableModal
ModalDialog
Floating
PlainBox
ShadowedBox
Rounded
GlobalFloating
Sheet
ModelessDialog

Okay, I will do