Skip to content

Instantly share code, notes, and snippets.

@jbratu
jbratu / YOUR_WINDOW_NAME_EVENTS.bp
Last active August 9, 2017 18:41
OpenInsight contains a commuter module generator to create a shell program capable of handling window events. It doesn't work so well in OpenInsight 9.4 so below is a basic version generated from the commuter module generator that can be easily customized for your window.
Function YOUR_WINDOW_NAME_EVENTS(CtrlEntID,Event,Param1,Param2,Param3,Param4,Param5,Param6,Param7,Param8)
//To use replace YOUR_WINDOW_NAME with your window's form name
*
* Blank Commuter Module
*
Declare Subroutine Msg, FsMsg, Set_Status, Set_Property
Declare Function Msg, Get_Property, Get_Status, Set_Property, Popup
Declare Function Repository, Send_Message, Send_Event, Unassigned, Utility, XLate
Declare Function ContextMenu
@jbratu
jbratu / popup_literal_example.bp
Last active November 25, 2016 20:23
The Popup function (see https://wiki.srpcs.com/display/Commands/Popup+Function) is very flexible but with flexibility comes complexity. This is a code example showing a multi-column Popup with literal data.
$Insert POPUP_EQUATES
Declare Function Popup
PopDisp = ''
PopDisp<PCOL$> = -1
PopDisp<PROW$> = -1
PopDisp<PWIDTH$> = -1
PopDisp<PHEIGHT$> = -1
PopDisp<PFILE$> = ''
PopDisp<PMODE$> = 'L'
@jbratu
jbratu / O4W_CS_TEST_DIALOG_HELLOWORLD.oibp
Created March 7, 2016 01:19
Simple OpenInsight O4W Hello World example with dialog.
Subroutine O4W_CS_TEST_DIALOG_HELLO_WORLD(CtrlEntId, Event, Request)
$Insert O4WEquates
$Insert O4WCommon
BEGIN Case
CASE EVENT _EQC "CREATE"
O4WForm()
O4WHeader("Hello World Example")
@jbratu
jbratu / CS_GetCompileDate.oibp
Last active February 11, 2020 14:08
Display the last date and time an OpenInsight program was compiled. Specify the name of the stored procedure and the routine will extract the username and compile date time from the end of the compiles routine.
Function CS_GetCompileDate(Routine)
*
* Read a compiled routine and extract the last compiled date and time stamp.
*
* Params:
* Routine - Name of the routine in the current OI application
*
* Returns:
* Displays the date time in a message box. Also returns the value.
*
@jbratu
jbratu / OPENINSIGHT_ROUTINE_LIB.oibp
Last active April 3, 2019 18:22
Basic OpenInsight function library. Similar to a commuter module but not designed to be called from an event context.
Function OPENINSIGHT_ROUTINE_LIB(inMethod, Param1, Param2, Param3, Param4, Param5, Param6, outValue,outStat)
//To USE: Find and replace OPENINSIGHT_ROUTINE with your routine name
/*
Function: OPENINSIGHT_ROUTINE_LIB
>OPENINSIGHT_ROUTINE_LIB(inMethod, Param1, Param2, Param3, Param4, outValue,outStat)
General purpose library
Parameters:
//Original source: http://www.sprezzatura.com/library/whitepapers/OI%20Coding%20Standards%20v1%200%207.pdf
//Protect any active select list. Pop it at end of routine.
saveAtDict_ = @dict
saveAtRecord_ = @record
saveAtID_ = @id
saveAtRecCount_ = @recCount
saveAtRnCounter_ = @rn.Counter
A_ = 0 ; B_ = 0 ; C_ = 0 ; D_ = 0
call push.Select( A_, B_, C_, D_ )
@jbratu
jbratu / bind plugin to button snippet.oibp
Last active April 11, 2016 01:45
Example jQuery plugin for OpenInsight O4W
O4WButton("Hello World", "BTN_HELLO_WORLD")
O4WQualifyEvent("BTN_HELLO_WORLD", "CLICK")
//Bind the sayhello plugin to the button
O4WPlugin("BTN_HELLO_WORLD", "sayhello", "")
Function CS_TransposeSort(A, Bys, Justs)
Declare Subroutine V119
ARowCount = DCOUNT(A<1>, @VM)
AColCount = DCount(A, @FM)
ATransposed = ''
*Transpose it for use with V119
@jbratu
jbratu / CS_TEST_MSG_GASGAUGE.oibp
Created May 18, 2016 18:15
Gas Gauge Processing Message with Updating Text. The standard help file for the OpenInsight Msg function shows a sample gas gauge for showing progress but it doesn't contain an example of how to change the processing text to indicate what the loop is currently working on. This example expands upon the help file example for Msg() and includes the…
Subroutine CS_TEST_MSG_GASGAUGE(void)
$Insert Msg_Equates
//Number of example processing loops
MAX_LOOPS = 1000
def = ''
def<MCAPTION$> = 'Gas Guage with Cancel Button'
def<MTYPE$> = 'GCU'
def<MTEXT$> = 'Initializing...'
@jbratu
jbratu / CS_SNIP_CreateCopy_ReadNext.oibp
Created May 23, 2016 18:32
A basic copy table function.Example routine creates the destination dictionary and data tables and writes the data using a select/readnext/write loop.
Subroutine CS_SNIP_CreateCopy_ReadNext(void)
Declare Subroutine Set_Status, create_Table,Msg,attach_table
declare function Set_FSError,Msg
$Insert Logical
*Source table to copy from
TABLE_NAME = "CUSTOMERS"
*Destination table to create and copy to