I think the issue relates to scope.
You may have two variables with the same name but I think to MapInfo Pro and your MapBasic application these may be different variables.
I would use this approach instead:
1. Keep a variable with the number of windows open, nNumWindows
2. Run the workspace
3. Check if there now are more open windows, if not, the workspace failed to open the layout and map
4. Else find the layout window that has been opened. You can loop over the windows opend by the workspace: For nWin = (nNumWindows+1) To NumWindows.
5. Once you have fun the layout, you can dig into this to find the map window(s) embedded here.
If you name your frames, you can use ths function to get their ID: LayoutItemID( window_id, frame, frame_type )
Say you named your frame “mapframe”, you can find the ID like this:
nFrameMap = LayoutItemID(nLayoutWID, "mapframe", LAYOUT_ITEM_TYPE_MAPPER)
Once you have the frame, you can also get to the ID of the map window:
nMapWID = LayoutItemInfo(nLayoutWID, nFrameMap, LAYOUT_ITEM_INFO_WIN)
I hope this helps
Peter
From: mapi...@googlegroups.com <mapi...@googlegroups.com>
On Behalf Of Matthew Hirsch
Sent: 14. maj 2024 23:44
To: MapInfo-L <mapi...@googlegroups.com>
Subject: [MI-L] Window ID var set in a workspace but cannot reference in MBX
This message originated Externally. Use proper judgement and caution with attachments, links, or responses. |
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en
---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mapinfo-l/b50d7676-7ae2-424e-a828-e2fcd4271380n%40googlegroups.com.