Getting the title of a window belonging to another WIMP application
Gavin Cawley (8462) 70 posts |
Hi, I am (very slowly) writing a simple IDE for RiscOS and I need to be able to find out the title of a window belonging to another WIMP application. My code is along the following lines:
This seems to work O.K. if the title icon is not indirected (except that it seems to have a CR at the end for some reason), but if it is indirected the buffer just seems to contain random values. I’m probably doing something daft, but I can’t spot it at the moment, can someone see what I am doing wrong? The window I am testing belongs to a program I wrote, so I can control what is in the title icon – it should be “Wombat” hence looking at the first seven elements of the string. |
Stuart Swales (8827) 1357 posts |
The indirected data is in the other application’s WimpSlot – you will need to extract a copy using https://www.riscosopen.org/wiki/documentation/show/Wimp_TransferBlock Also note that (non-indirected) icon text can be exactly twelve bytes; no NUL-terminator will be present. Try
[Edit: As I have only coded in C for the desktop for the last thirty years, I always forget that any CtrlChar may be used to terminate icon text! This will be important if you are grokking other people’s data…] |
Gavin Cawley (8462) 70 posts |
thanks for the rapid response, I’ll give Wimp_TransferBlock a try! |
Gavin Cawley (8462) 70 posts |
Thanks again Stuart, that worked a treat! Do you know if there is a way to find the task handle (wimp_t) from the window handle (wimp_w) of a window belonging to that task? At the moment I have hard-coded the task name and used TaskManager_EnumerateTasks to find the handle, but that is a bit of a limitation for my application. |
Stuart Swales (8827) 1357 posts |
Scratches head, vague memory… From the PRM: “Note that you can use User_Message_Acknowledge to discover the task handle of a given window/icon by calling Wimp_SendMessage with R0=19, your_ref = 0, and R2/R3 the window/icon handle(s). On exit R2 will contain the task handle of the owner, though no message would actually have been sent.” I guess this is a Spy++ -like application? |
Gavin Cawley (8462) 70 posts |
Cheers, I’ll look into that. I’m writing a program to make a tab bar that you can hang other windows from and manage them in a convenient way. One of the things I dislike on RiscOS when I am programming is having lots of SrcEdit windows floating around the screen, so I thought this would be a useful tool while I am writing my IDE. There are a fair few issues with it at the moment, but it is sort of getting there. It is also a test program for my IDE, which is designed to wrap around whatever suitable editor you like using, rather than being one monolithic program. Probably not making life any easier for myself, but more fun! |
David J. Ruck (33) 1636 posts |
Have you looked at my WindOpen module, it might save you a bit of time http://www.armclub.org.uk/free |
Gavin Cawley (8462) 70 posts |
Thanks David, WindOpen looks very useful (as do !workspace and !ARMalyser) |
WPB (1391) 352 posts |
Your IDE sounds interesting, Gavin. Looking forward to hearing more details! ;) |
Gavin Cawley (8462) 70 posts |
It’s intended to be a fairly minimal IDE with tabbed editor, throwback and project browser, suitable for small-medium sized projects. I made a brief video to celebrate it building hello world for the first time: It hasn’t made much in the way of visible progress since then. At the time the editor was still part of the IDE itself, but I’ve now refactored it into a separate program so that I can experiment with messaging between applications etc. |
Stuart Swales (8827) 1357 posts |
Remember MS Programmer’s Workbench? I liked that. Used it quite a bit on OS/2 in 1989-91 to write and debug some routines for PipeDream and then proto-Fireworkz for RISC OS that would have been far too hard to do natively. |
Gavin Cawley (8462) 70 posts |
I taught using Turbo C back in the 90’s which looks quite similar. I mostly program on UNIX with vi and the command line tools, I normally only use IDEs when teaching. I think if RISC OS had a simple IDE back in the ’80s or ’90s I would have done more WIMP programming back then (rather than just play games and a bit of writing and drawing). My tab-bar program is sort-of working now, thanks again for the advice. I just need to work out why the !SrcEdit windows are not redrawing properly – I was hoping that just reopening the windows (and forcing a redraw) would be sufficient, but I suspect I am missing something. |