Converting a procedure that worked fine in 6 and is giving me fits in X. I have a little collection of 6 buttons, each of which is designed to take you to a particular record in a customer database. Each user can customize these for his own needs. Each button has a “title” that is the account number (key value) of the desired record, and an overlaid Text object that contains the company name associated with the record, so the user knows what he is pushing. Each Push Button Superobject (in 6) has “Hide Title” checked, so that the company name serves as the visible “title” on the button rather than its own object title, but when clicking it the objectinfo( of that button contains the invisible title to use to select the right record. To set up a button initially (or modify one that was already set up) the user goes to the record of the desired company, then Command-clicks the button he wants to associate it with, and Voila the button now is set up with all of those characteristics. I had a lot of help from either David or Gary, can’t remember, in setting up objectinfo( parameters, and it works very nicely. I haven’t tried the “write” part of the code since I can’t get the “read” stuff going, but the buttons are already set up with proper titles and names from the transition from 6.
In X it isn’t working at all, and stepping through it is fraught with the same peril that stepping can invoke (another thread). But I have determined where it first fails, which makes the rest of it fail. Each button has the object name “UsrBtn” with a sequential digit appended to the end (e.g. “UsrBtn3”) which is retrieved into the “indx” value.
local MyBtnLoc, indx, ThisBtn, MyAcct
MyBtnLoc = xytoxy(info("buttonrectangle"),"S","F")
Selectobjects objectinfo("rectangle")=MyBtnLoc
ThisBtn=objectinfo("name")
indx=val(ThisBtn[-1;1])
MyAcct=val(objectinfo("title"))
The failure point is the ThisBtn= step; it retrieves “” as the name, and thus 0 for the indx. Consequently, the MyAcct= line doesn’t even execute (this is where if I Step, the highlight jumps back to the first line of the procedure) and there is no error message of any kind.
I’m wondering if the “buttonrectangle” step is doing anything, I don’t know how to evaluate it.
I’m unclear whether I have the right argument value for the last line; my Pan 6 code uses “#BUTTON_TITLE” which I gather isn’t supported in X; I have used “title” as the likely successor, but of course neither does anything at this point. Since X doesn’t have a “Hide Title” option for Push Button Options, I have checked “Rich Text” and set the title color to white, works fine.