4DPop KeepIt is a snippets manager, these little bits of code or text that you reuse everywhere.
This tool allows you to store pieces of code and reuse them when needed through:
- a keyboard shortcut
- drag and drop
- copy and paste
Stored items are persisted across sessions and remain accessible from all databases once the component is loaded.
4DPop KeepIt is similar to 4D macros, but easier to use and more powerful.
This component is compatible with the Project Dependencies feature. You can easily integrate it into your project by selecting “Design” > “Project Dependencies,” then choosing the GitHub tab and adding “vdelachaux/4DPop-KeepIt” as the repository address in the dialog box provided for this purpose. This will allow you to receive updates over time.
📍No more notarisation problems with this installation method!
If the component 4DPop is not installed, create a method that calls:
KeepIt_tool- Select a snippet of code in the editor.
- Drag it onto the 4DPop toolbar.
- Drop it on the KeepIt button.
- Enter a name for the new item.
Done.
In the editor, type:
$$ + Tab
A popup menu appears.
Select the desired item and its content is pasted into the editor.
Snippets can contain tags evaluated at insertion time.
They use the same syntax as 4D macro tags.
In addition to native 4D macro tags, KeepIt adds the following.
Replaced by a generated UID.
Replaced by the structure file name.
Includes another KeepIt item.
name: item name to include
Example:
<keepit name="common_declaration"/>Creates an interactive macro.
message: displayed prompt texttype: expected answer type
Example:
ARRAY TEXT(<ask message="Name of the array?"/>;<ask message="Size of the array?"/>)
For($i;1;Size of array(<ask message="\1"/>);1)
<ask message="\1"/>{$i}:="<ask message="Default value?"/>"
End forSupported type values:
textintegerrealtablefieldusergroup{value1;value2}{label1:value1;label2:value2}
Replaced by the content of a text file.
url
Supported forms:
- absolute path:
file://... - relative to database
Resources:#... - relative to KeepIt
Resources:/...
Repeats a line multiple times.
count
Example:
<iteration count="10"/>C_TEXT(vTEXT_<iteration/>)Sets a project method attribute.
typevalue
Example:
<method-attribute type="1" value="true"/>Replaced by the type of the currently edited method.
#_IF
#_ELSE
#_ENDIF
Example:
#_IF <ask message="Are you a woman ?" type="{Yes:1;No:0}"/>=1
// OK, you are a woman!
#_ELSE
// You are probably a man
#_ENDIFClick the KeepIt toolbar button to open the editor.
![]() |
![]() |
Features:
- drag item into method editor
- copy interpreted content to clipboard
- rename by double-click
- edit text in right pane
- context menu actions
- export/import snippets
- drag export to desktop
- drop text files to import
Comments are supported:
/* ... */
The first comment becomes the tooltip.
KeepIt installs 3 macros when loaded.
| Name | Shortcut | Text entry | Description |
|---|---|---|---|
| KeepIt | Cmd + € | $$ |
Displays selection menu |
| KeepIt = | Cmd + = | ++ |
Calls last snippet |
| KeepIt + | Cmd + ± | — | Creates fragment from selection |
A shared method is available:
Keepit_get_item_by_nameIt can be used inside 4D macros.
Example:
<method>Keepit_get_item_by_name("database_name")</method>The component is distributed compiled.
Source code is available in the Sources folder inside the component folder.
Dedicated forum:
- 4DPop Forum
Useful for 4DFR / 4DINTL compatible macros.
Localized 4D command name.
number
Example:
<command number="34"/>Localized 4D constant.
id
Example:
<constant id="2.2"/><if/>
<else/>
<end_if/>
<case_of/>
<end_case/>
<while/>
<end_while/>
<for/>
<end_for/>
<repeat/>
<until/>These tags are replaced by localized control structures.
This allows the same snippet to work in:
- 4D INTL
- 4D FR


