Part of Templates and the Application Generator: the hub. 116 entries under this heading; every entry opens as its own topic.
- An #EMBED generated inside #FOR(%File) shows in the generated source but not in the Embed Tree (Reported, not reproduced) - Per-file embeds from a FOR loop appeared in generated source but not the Embed Tree; MAP on the embed worked in one test, not in the poster's extension.
- %Prototype and %Parameters are cut at 255 characters and no template file defines them - The 255 character cut of prototype and parameters is not defined in any template file, as the IDE owns those symbols; pass a typed group or queue.
- Can a template read the hand-written code that sits in an embed point? - No template symbol holds hand-written embed code; parse an exported TXA, or repeat the embed inside CREATE and CLOSE to catch it in a file.
- Code a template generated stays in the app after the template is removed - Do an unconditional regenerate to clear embed code; data in GLOBALDATA stays, so declare it with an AT on DataSection to keep it attached.
- Creating #EMBED points inside a #FOR loop and keeping them unique - Add the symbol attribute to the #EMBED, optionally with TREE, and make sure the symbols hold values (loop or #FIX) when the embed runs.
- Extension class methods at %LocalProcedures: duplicated when two procedures in a module use it? - Class and methods declared per procedure at DataSection and LocalProcedures do not clash in one module; the errors seen were spurious ones from something else.
- What is the #AT embed name for a global File Manager method such as TryUpdate? - Global File Manager method embeds use the symbol %FileManagerCodeSection with table, method name and prototype, for example TryUpdate with '(),BYTE'.
- Adding a "Program to Execute" step to the project file from a template - #PROJECT only adds a file; put a batch file in the project's programs to execute and let the template write its content with #CREATE, #CLOSE.
- "No matching prototype available" on a browse procedure called from a button embed (Reported, not reproduced) - A browse procedure called from a button embed gave "No matching prototype Available" at ThisWindow.Update; suggestions on parentheses and spelling were offered, no fix was reported.
- Code after Post(Event:CloseWindow) in an embed point still runs before the window closes - Post(Event:CloseWindow) only queues the event, so embed code after it still runs; RETURN right after it, guard the rest with an IF, or use ThisWindow.SetResponse(RequestCancelled).
- Writing functions and class methods inside a Source(ABC) procedure - A Source(ABC) procedure takes functions via a MAP in the Data Section plus Local Procedures, or a derived class from the user-controls extension; omit the return type on the implementation line.
- Stopping a second copy of the program from starting: the one-instance template fails on Windows 2000 - Edit the one-instance template to drop PATH() from the instance ID line so it works on Windows 2000; a named mutex is the reliable alternative.
- An #AT on %BrowserMethodCodeSection for one SetSort overload generates nothing (Reported, not reproduced) - An #AT naming one SetSort prototype on the browse method section generated nothing; suggested instance symbols and prototypes did not help the poster, and nobody reported a fix.
- Which embed point sets DefaultFill to 0 on a file drop list? (Reported, not reproduced) - Setting DefaultFill in the OpenWindow embed changed nothing; posters advised after the files open and before the window opens, with no outcome reported.
- Coloring the headers of every list box in an application at once with a template - Color every list header with a global procedure looping the window's list controls, called by a global extension template at the AfterWindowOpening embed.
- A FILE declared in a local data embed gives "file not found" on OPEN, although CREATE is set - A hand-coded FILE in a local embed needs CREATE before OPEN; set the name at run time with PROP:Name, or mark a local name variable STATIC.
- "File Access Error, File could not be opened. Error: Invalid Filename (45)" after moving a working app to a newer build - Invalid Filename (45) came from setting the file name in a global embed before opening in the main procedure on ABC; set it in an earlier procedure or check embed priority.
- What is the Local Procedures embed for, and can it hold a local MAP with ordinary procedures? - Local Procedures holds the methods of local classes; a local MAP with plain procedures was warned against, so put such a MAP in the Module embeds.
- Source procedure: code in Before Opening Files and the other file embeds is never reached - A Source procedure never runs the file-handling embeds; call the generated routines such as OpenFiles yourself, or use a Window procedure without showing a window.
- Embedding code in another template's embed point (the resizer's Resize method), and listing template instances - Select the resizer's Resize method embed with a WHERE on method name and prototype instead of an instance; list instances with a nested loop, or use the parent instance symbol.
- UPDATE(?) in a NewSelection embed stops the Accepted embed of the control from firing (Reported, not reproduced) - UPDATE in NewSelection stopped the Accepted embed; PROP:Touched and POST did not help the poster, who found the cause but did not say; no settled answer.
- A check box Accepted embed runs twice: on the click and again when OK is pressed - Accepted runs again at OK because of non-stop select mode; wrap the code in a test that the window property AcceptAll is false.
- A global extension's #AT at priority 7500 generates before the files are opened (Reported, not reproduced) - A global extension embed at priority 7500 generated before the files opened; FIRST did not help, the legacy AfterFileOpen embed worked for the poster, cause unanswered.
- A class's CONSTRUCT method runs twice when its INC is included in the global embed and in its own CLW - An untyped CLASS in an INC makes a new instance at every INCLUDE, so CONSTRUCT runs per module; add the TYPE attribute and declare instances only where needed.
- AppBroker app called from another port: where to set the CORS response headers? (Reported, not reproduced) - A TakeBeforeBuildingHeaders global embed adds CORS headers to the broker's HTML only; the initial exe call from another port still failed, no outcome.
- Where do I put the prototype of a local procedure that only one Legacy window procedure should see? - Put the local procedure's prototype in a MAP in the procedure's Local Data, Generated Declarations embed; keep the body in Local Procedures.
- Declaring a FILE structure with keys in an embed, without putting it in the dictionary - Declare a FILE with its keys in any data section by copying a dictionary declaration; templates cannot see it, and a variable file name must be static.
- POST(Event:Accepted,?OK) from an embed on an update form gives "Can't log transaction" (error 48) - Error 48 comes from LOGOUT in the Relate Update call when the buffer changed; here another open file made the logout fail.
- My embed code was clipped and the compile fails: how much code can one embed point hold? - An embed point clipped its code and broke the compile; split the code into several embeds at the same spot or into routines, one per embed.
- A procedure call sits in column 1 of the embed and still compiles: how is that possible? - A call at column 1 in an embed comes from a check mark next to the priority that starts code in column 1, or from a call extended template.
- Storing Word, PDF or picture files in an SQL BLOB from an AppGen app, and opening them again - Reach a BLOB from embed code with FileToBlob to load a file, BlobToFile to save it, and ShellExecute to open it.
- An #AT(%FileManagerCodeSection,,'Init','()') in my template generates no code (Reported, not reproduced) - An AT on the FileManagerCodeSection Init embed generated nothing in a template; a missing file name and a missing APPLICATION attribute were suggested, with no outcome reported.
- "No Matching Prototype Available" on START(ReportProcedure, 50000) - START of a procedure gave No Matching Prototype Available because the procedure had parameters; optional parameters are not allowed on a STARTed procedure.
- Getting the window's design-time width and height after it has been resized - Read the window size in an embed that runs before the resize code in WM.Init, or use PROP:OriginalWidth and PROP:OriginalHeight from build 11.0.13505.
- A variable set in the window's GainFocus event embed is not set in a multi-DLL ABC app (Reported, not reproduced) - A variable set in the GainFocus window embed of a multi-DLL ABC app stayed unset; one poster pointed to TakeEvent, another to INIT, no cause was found.
- More than 400 compile errors after adding INCLUDE('ClaRunExt.INC'),ONCE to a big app - Over 400 compile errors after including ClaRunExt.INC came from an app procedure named DownloadFile clashing with one in ClaRunExt.CLW; renaming the procedure fixed it.
- After changing a file from TPS to MSSQL in the dictionary, the generated FILE has NAME(GLO:...) and no CREATE - A generated NAME(GLO:...) after a TPS to MSSQL change came from the FM3 global template; uncheck its option to manage file names.
- A #AT embed for the start of the Declaration Section does not work when the symbol has a space - Template symbols cannot contain spaces; the Declaration Section embed in a #AT statement is written %DeclarationSection.
- Why POST(EVENT:User) and then OF EVENT:User START(...) in one embed after opening the window? - POST only queues EVENT:User for the next ACCEPT cycle, so the window finishes initialising before the child START runs; the poster removed it and the START still worked.
- RUN('NOTEPAD.EXE') in a button's Selected embed works once, then not again until the form is reopened - Selected does not fire again on an already selected button; put the RUN code in the Accepted embed, which fires on every press.
- Which #AT label gives the "After Opening Window" embed in an ABC template, and where are all the labels listed? - Use the window manager method section with the Init method and a priority; a small code template shows the exact AT line for any embed point.
- Does the Timer embed work in an H5 (web) procedure? How do I keep elapsed time? - The Timer embed works in H5 procedures; the H5 template refresh options are separate and do not reload a browse, while the Timer embed can.
- Browse AlertKey embed code never fires (Reported, not reproduced) - Browse AlertKey embed never ran while the legacy embed did; the poster fixed it after cleaning, deleting generated files and rebuilding, cause unknown.
- Reading an Excel .xls file like a CSV: the ODBC driver or the Office template calls - Read an .xls file through the ODBC driver with an Excel owner string, or cell by cell with the Office template's Excel object calls.
- Field edits from a Legacy app's CASE FIELD() embed do not fire in ABC until the user clicks OK - Make ABC field edits fire as the user tabs off: set PROP:Touched in each Selected embed, use a control monitor template, or move the CASE FIELD() code into TakeAccepted.
- How do I generate a GUID from an app built with the templates? - Prototype CoCreateGuid in the global map, include svcomdef.inc, declare a local LIKE(GUID) variable and call it; StringFromGUID2 gives a printable string.
- POST(Event:Accepted) on a field does not run its embed code: how to simulate the Tab key? - Post Event:Selected instead of Event:Accepted, and set the control's touched property to true before posting Accepted so validation code runs.
- Reading a subset of a SQL table with PROP:SQL in hand-written code - A PROP:SQL select needs a FROM clause and fields in record order; copying the SQL rows into a local TPS file was the poster's chosen route.
- A ULONG entry control rolls over past 4,294,967,295 and the validity check never sees it - A ULONG entry wraps past 4,294,967,295 before any check sees it; test a local DECIMAL or read PROP:ScreenText instead.
- Generating common code in the Accepted embed of every button chosen in a multi-value #BUTTON - A single-valued symbol will not repeat an #AT; use multi-valued %Control with a filter inside, or build your own multi-valued symbol in #ATSTART.
- Web Builder: static HTML typed into the "inside the title" and "inside the meta tag" embeds does not appear (Reported, not reproduced) - Static HTML in the Web Builder title and meta embeds did not appear; Response.Write and the skeleton TSSCRIPT tags were suggested, no outcome reported.
- Hand code in the BrowseClass.PrimeRecord embeds became orphaned when C5 apps were opened in C5.5 (Reported, not reproduced) - Hand code in the PrimeRecord embeds was orphaned when C5 apps were opened in C5.5; replies blamed removed embed points or a generator bug, with no outcome.
- Which ABC embed opens a procedure automatically when the frame opens (no menu) - In the frame's TakeWindowEvent after the parent call on EVENT:OpenWindow, START the browse, or post a user-defined event; starting earlier gave GPFs on MDI windows.
- Code in the Window Manager "after Open Files" embed does not fire (Reported, not reproduced) - Code after Open Files did not fire; replies suggested checking the generated source, and removing the file from the local schematic since its open is generated twice, with no outcome.
- HTML help opens the first contents topic instead of the window's topic - HTML help opened the first contents topic; remove STD:Help from the Help button, then SetTopic in Init and SetTopic plus ShowTopic in the button's embed.
- A second date field set in an embed does not refresh on the update form (Reported, not reproduced) - A second date field set in an embed did not refresh on the update form; DISPLAY failed and a reply suggested a variable, with no reported outcome.
- "Unknown procedure label" for a procedure called from hand-written embed code - Add the called procedures to the calling procedure's Procedures list or check Declare Globally on them, so they are in its map; also check Create Local Maps.
- Opening a window on a tab other than the first one - Setting the tab in Init gets undone by ABC; change the generated SELF.FirstField line to the wanted control in an embed placed after it.
- Copying a BLOB to another table in a process TakeRecord embed leaves NULL in the destination - Copying a BLOB by PROP:Handle in a process TakeRecord embed gave NULL; for a one-off job the poster used PROP:SQL to copy on the server instead.
- Getting the primary file name of a browse at runtime in the Ask embed - In a browse embed, SELF.Primary.me.GetName() returns the primary file name at runtime; the template language offers %Primary only at generation time.
- Embed code that works on one browse has no embed point on the second, identical-looking browse - Embed code with no embed point on the second browse was sitting in the Orphaned section of the embeds; check the control's Use name and that section.
- ASCII file in an ABC app: how do I stop the driver clipping trailing spaces? - Put /CLIP=off in the Driver Options field of the dictionary file, or in the DRIVER string, instead of sending it from an embed; then recompile.
- Which #AT gives the "All Events" embed of a field's control handling? - Insert the CreatAtFromEmbed code template (TUTIL.TPW, Template\Win) at the embed to see its #AT line; add TUTIL.TPW to the template chain if it is missing.
- A function template returns one value: how do I set one bit on and two bits off in the same LONG? - A function embed needs only one RETURN: assign the result back to the same variable in sequence, then return it, or pass parameters by address.
- Creating the DIRECTORY queue for a window procedure and showing it in a list box - Declare the typed DIRECTORY queue from the Help example in the procedure's Data area via the DATA button so a list box sees its fields.
- DASTAG template: the space bar tags two records at once - The DASTAG template trapped the space bar on PreAlertKey; moving that code to AlertKey, in the generated method or the template's AT line, tags one record.
- AppBroker (Clarion 10): keep a web session alive without refreshing the page, so a form does not lose its data - Add a setInterval script sending a GET to the form's action address in the web procedure extension's On Document Ready to keep an AppBroker session alive without a page reload.
- SETNULL on foreign key fields in PrimeFields is lost before the ADD on MS SQL (Reported, not reproduced) - SETNULL on foreign key fields in PrimeFields was lost before the ADD on SQL; readers tried PrimeRecord, PrimeAutoInc and priority 1300, with no confirmed result.
- GetTextRTF is not offered in any embed point; showing RTF text without the RTF coding in a browse - GetTextRTF is not offered in the RTF embeds; a reply said to call GetText instead, and the poster reported success without details.
- Showing the newest matching record of a second file in a browse column: the queue in SetQueueRecord never filled - A queue filled in SetQueueRecord for the newest record of a second file worked after FREE, CLEAR and a loop rewrite; a GetConsent function was also suggested.
- Renaming ProgressWindow in a Process procedure gives a compile error: the name is hardcoded in the templates (Reported, not reproduced) - Renaming ProgressWindow in a Process procedure failed to compile because process.tpw and report.tpw hard-code the name; the poster waited for a template fix.
- Copying all records from one file to another in an embed on the OK button, then emptying the source file - Assign Destination = Source, loop on NEXT and test the error code (ABC: LOOP UNTIL Access:File.NEXT(), then INSERT; Legacy: ADD), then CLOSE and CREATE to empty the file.
- Asking "are you sure?" when a check box on a form is ticked, and cancelling the tick - Put the confirmation in the check box's Event:Accepted embed, test that PROP:AcceptAll is off, reset the variable to false and CYCLE when the user answers No.
- Showing a login window before a browse, and getting a result back from the login procedure - Call the login procedure from Init, return LEVEL:Fatal when it fails, and give the login procedure a BYTE return value set before posting CloseWindow.
- Trapping the window's X button (and ESC) before the ABC Kill process starts - Trap the X button in TakeCloseEvent before the parent call, or use the CloseWindow window event before generated code, which also catches the ESC key.
- Where to put code that two embeds on one form both need (30 hide statements run at open and at OK) - Put the shared code in a routine in the Procedure Routines embed, or a source procedure taking the control number as a parameter, or use TakeEvent.
- RETURN from the Procedure Setup embed ends with "ACCEPT loop requires a window" - RETURN in Procedure Setup only ends a method, so the window manager still reaches ACCEPT; test the condition before calling the procedure, or return from ThisWindow.Run.
- Numeric fields written back to an ASCII card file come out left justified, whatever the picture - Numbers written to an ASCII file came out left justified; use FORMAT with an n07.2 picture in the before-writing embed, an N_7.2 record picture, or RIGHT of the FORMAT result.
- Using a Windows environment variable (such as a network image path) from a Clarion app - Declare CSTRING variables in AfterGlobalIncludes, prototype GetEnvironmentVariableA in the GlobalMap embed, and call it in code to read a Windows environment variable.
- A template's own MESSAGE procedure in the global MAP gives "Unknown Procedure label" inside a third-party Legacy class (Reported, not reproduced) - A template's own Message in the global MAP was not seen inside a third-party class declared as TYPEs; the poster replaced his messages with STOPs.
- Housekeeping in the frame's Kill embed does not run when a terminal server session is cut off - Kill-procedure embed code cannot run when the session is killed; poll the session idle time and exit the program before the timeout.
- One embed point to run a calculation routine whenever any of ten entry controls changes - To run one routine when any of several entries changes, embed in the window class TakeAccepted, TakeEvent or TakeFieldEvent methods, or use a free ControlMonitor template.
- Embed code on the CalendarButton runs before the calendar shows, not after the date is chosen - Code after a CalendarButton ran before the date was chosen; raising the embed priority past the calendar class call (6030 worked) runs it afterwards.
- "Wrong embed for adding a field to the AutoBind" on the Embeds tab after adding a report extension (Reported, not reproduced) - The wrong-embed AutoBind message comes from the BIND-list groups in PROCBIND.TPW; a stray PUSHBIND in generated source was suggested, with no outcome posted.
- Where do I embed SELECT() to set focus to a control after changing to a tab? - Put the SELECT code in the sheet's NewSelection or TakeNewSelection embed, with a CASE CHOICE of the sheet selecting the wanted control per tab.
- "Wrong Number of Parameters": the generated browse VIEW has a JOIN without its linking field - A generated VIEW JOIN missing its linking field gave Wrong Number of Parameters; fix the dictionary relation or schematic join, or restart the IDE and generate all source.
- A LOGOUT / COMMIT in an embed locks the program at one customer site (Reported, not reproduced) - LOGOUT and COMMIT in a Kill Procedure embed locked up at one site; switching to STREAM and FLUSH stopped it, opportunistic locking was suspected, cause not settled.
- A window running a batch load from an embed stops showing its progress counter - A batch load in the Refresh Window embed stopped repainting its counter; calling YIELD in the loop fixed it, with DISPLAY and a timer also suggested.
- Emptying a text file in an Init embed gives "Assertion failed in abfile.clw. You have not called fileManager.usefile()" when the file is missing - Opening a missing text file in an Init embed raised the abfile assertion; testing with EXISTS before OPEN, EMPTY and CLOSE cured it.
- An F2 alert key on the window to trigger the lookup of whichever field has focus: FIELD() returns 0 - A window-level alert key gives FIELD() and SELECTED() as 0; use FOCUS() to find the field that had focus when the key was pressed.
- Office templates mail merge opens the Word document as a plain document, not a merge (Reported, not reproduced) - Office template mail merge opened the Word document without running its query; visible Word, display alerts and screen updating methods were suggested, no outcome posted.
- The "Beginning of Procedure, After Opening Files" embed of Clarion 5.5 is missing in Clarion 6.1 - The old after-opening-files embed is Window Manager, Init, Code, Open Files in the ABC tree; Show Legacy Embeds (Ctrl+L) reveals where old embeds land.
- Putting a line break or other HTML tags into a cell of a web browse list - Cell text from a web list is escaped, so put a token like a pipe in the text and replace it with HTML in JavaScript.
- The AlertKey embed point is missing on a control: define an alert key first - The AlertKey embed point only appears after you right-click the control, choose Alert and enter the keys to alert.
- How to get the USE variable name of a control in an embed (a button with USE(?a1)) - Prototype ClaFieldName in the global MAP, take the control number with SELECTED() and call it to get the control's name as text.
- A 2,000 character local variable built in an embed is cut to 255 characters in the email body - A 255 character cut in an email body comes from the extension's body queue; split the long text into 255 character pieces in a source embed.
- Debug lines starting with ? in an embed give "Routine / Goto label duplicated" (Reported, not reproduced) - Question-mark debug lines in an embed raised Routine / Goto label duplicated on one procedure; column 1 checks did not help, a compile() wrapper was suggested but untried.
- Code in Take Completed does not work when the form uses Insert Another Record - Insert Another blanks the record inside the parent TakeCompleted; add a class method called after the batch save, or test ReturnValue after the parent call.
- Translating the QBE form of an ABC browse: what is the window's label? - Translate the QBE form in the Init embed of its QBE visual class, after the parent call, using Self.MyWindow.
- Refreshing a droplist control template from embedded code - Refresh a droplist from embed code by calling ResetQueue on its file-drop manager object; check any filter, the poster's fault was a syntax error.
- Showing a different character as the user types: ALIAS in the Procedure Setup embed did not change the key (Reported, not reproduced) - ALIAS in the Procedure Setup embed was suggested to show a different character per keypress, but the typed letter still appeared; no outcome.
- Hiding fields and buttons on an update form when the request is Insert, showing others on Change - Hide and unhide controls in the window Init embed by testing Self.Request, naming each control with the leading question mark; consecutive controls can be hidden as a range.
- Calling the same routine whenever any field on a form is selected, without an embed per field - Test Event() = Event:Selected once in the window's TakeEvent embed instead of putting a call in each field's Selected embed.
- Compiler warnings "duplicate label": how do I find where the first definition comes from? - Find the first definition of a duplicate equate by content search of an exported TXA, LIBSRC and the template folders.
- Emptying a BLOB field (Firebird) that FreeImage filled, to delete the stored picture - Set the BLOB size to zero and then update the record; the change only reaches the table when it is written.
- Browse New Selection embed does not fire on a single left click - Code that missed a single left click worked on EVENT:Accepted; for ABC the browse TakeNewSelection embed after the parent call was also suggested.
- Using the timer event in an app that should show no window (a background RS232 service) - Hide the main window with PROP:Hide in the window manager Open the window embed so timer code runs unseen; a Sleep loop was another idea.
- A LoseFocus embed that captured text from another window worked in C5.5 but not after conversion to C6 - LoseFocus and GainFocus events were reported not to fire in C6, explaining a capture embed that worked in C5.5; FindWindowEx finds another program's window.
- Which ABC embed point corresponds to my legacy embed (hide the window, press a button)? - Find the ABC embed by viewing the generated source next to the legacy embed priority; place the code after SELF.Open(Window) and POST after OpenWindow.
- Replacing the global error message box in Clarion 6 with one that has an extra button - Set SYSTEM{PROP:MessageHook} to your own function in a global embed, or use a commercial message box accessory; no result was posted.
- Running code when the user leaves a tab of a sheet - Use the sheet's TabChanging embed, where CHOICE still gives the tab being left; NewSelection runs after focus moved, and PROP:ChoiceFEQ survives tab reordering.
- Orphaned embeds after importing TXAs: do they affect the EXE, and how to remove them quickly - Orphaned embeds are not generated and do not change the EXE; export the app to a TXA and import it into a new app to remove them.
- Assertion failed in abfile.clw "You have not called FileManage.UseFile()" after Setname and Open on a new file name - After Setname and Open on a new file name, call UseFile on the file manager, and close, set the name, then open in that order.
- Window positions in an INI file are overwritten between users on a terminal server (glo:iniloc) - Give each user an own INI file in a per-user CSIDL folder, or keep the positions in the registry under the current user section.
- Cancel button with POST(Event:CloseWindow) triggers the lookup of a field - Set ThisWindow.Response to RequestCancelled before POST(EVENT:CloseWindow) in the Cancel button, so the window does not treat the close as OK.
- IDLE() set in the frame's ThisWindow.Init embed runs 10-20 times a second - IDLE in the frame Init embed ran many times a second; posters suggested the Enter Procedure Scope embed or a timer on the frame instead.