Tips   >   Externals   >   Externals (All Contents)
Trying to find documentation on the external components provided with Omnis Studio can sometimes be a challenge.
This section is an attempt to document and demonstrate the external components provided by Omnis Studio.
If you have information or demos, please email them to doug@vencor.caTo use an external component you need to instantiate it with a variable.
If an external component is not in the
node of the object variable subtype, you need to set Omnis Studio to pre-load it using the window.The function sys(4019) opens an window.
Click the
Scroll through the list of external compenents. When you click on a component, the properties, events, and functions supported by the component are listed. When you click on a property, a description of the property is displayed in the bottom of the browser. button in the to open the .The blowfish external can be use to encrypt/decrypt passwords.
It is best to store all passwords in an encrypted form so that nobody, not even the system administrator, can see actual passwords. If a user forgets their password it is better practice to reset the password, than to view their existing password.
To use the blowfish external you need to instantiate it with an object type variable.
Calculate cInitialKey as 'mykey'
Do oBlowfish.$initkey(cInitialKey)
Prompt for input Enter a password to encrypt Returns MyPassword
Do oBlowfish.$encrypt(MyPassword) Returns cBinaryVariable
OK message (Icon) {Your password has been encrypted to a binary value using the key '[cInitialKey]'////The 'Decrypt a String' demo will decrypt the string.}
Do oBlowfish.$initkey(cInitialKey)
Do oBlowfish.$decrypt(cBinaryVariable) Returns DecryptedString
OK message (Icon) {The decrypted password is: '[DecryptedString]'}
I am a newbie to encryption so the following comments are just some of my initial thoughts on implementing blowfish.
Where do we store the key?
Calculate cInitialKey as 'mykey'
Prompt for input Enter a password to encrypt Returns MyPassword
Do oBlowfish.$initkey(MyPassword)
Do oBlowfish.$encrypt(MyPassword) Returns cBinaryVariable
OK message (Icon) {Your password has been encrypted to a binary value.}
Prompt for input Enter your password Returns RenterPassword
Do oBlowfish.$initkey(RenterPassword)
Do oBlowfish.$decrypt(cBinaryVariable) Returns DecryptedString
OK message (Icon) {The decrypted password is: '[DecryptedString]'}
The Omnis Studio
discusses an optional header parameter as follows:The bIncludeHeader parameter is a boolean to indicate whether or not a header should be appended to the data. The encrypted data is always the same length as the decrypted data except for an additional 8 byte header (if required).
I tested encrypting a message with bIncludeHeader set to true, and then decrypting with bIncludeHeader set to false. (Just to see what would happen.) This exercise succeeded in crashing Omnis Studio v4.0. Needless to say I didn't bother testing any further.Documentation on the
is available in the by searching for . (not HTML Control as I discovered.) Some of the information in this section is copied directly from the .The
is an external component for viewing HTML files in a window class. The is used extensively in Omnis, specifically in the application to display the Omnis help and tutorial HTML files.When placed on a window you can change the properties of the HTML component under the $dataname property, instead you specify the path to an HTML text file in the $filename property. You can set the $filename in design mode or set it dynamically at runtime.
tab in the . The component does not have aThe HTML control can display HTML files stored locally. Unfortunately, the HTML control can not display files or images on the internet.
Use the openURL object class available in the downloads section of the studiotips.net to open the client's default web to a URL which you specify.
The section explains the special properties and methods for the HTML control.
Click the
The first time you run this demo, you must click the button in the to test the various properties and methods of an component. button and point the control to a valid HTML file on your computer.The HTML component reports many different events and you can write event handlers in the object's $event method to handle them. When you create the HTML component from the a template $event method is inserted to handle the basic events in the object at runtime. Note all the events for the HTML component return the $ident of the field as the first event parameter.
The HTML component receives the following event messages:
pEventCode, pCtrlIdent, pHRef, pName, pTarget, pTitle
pEventCode, pCtrlIdent, pTitle
The sample code below was pasted from the $event method of the in the .
On evAnimateScrollEnd
;
On evSetTitle
Calculate $cwind.$title as pTitle
On evHyperlink
If pos(".lbs",pHRef)
Calculate lOmnisLibPath as pHRef
Do $cobj.$pathtoapi(lOmnisLibPath)
Open library (Do not close others) {[lOmnisLibPath]}
Else
Do method $setUrl (pHRef)
End If
On evEventTag
; deal with custom html events
On evExecTag
; deal with the following html tags (pTagValues contains list of propertie names and values)
; <BGSOUND loop=value src=url>
On evImagePluginCreate
Switch pType
Case 'JPEG'
Set reference lObjRef to $cinst.$objs.$add(kComponent,"JPEG Library","JPEG Control",-100,-100,10,10,kFalse,kFalse)
Case 'GIF'
Set reference lObjRef to $cinst.$objs.$add(kComponent,"Gif Library","Gif Control",-200,-200,10,10,kFalse,kFalse)
Case 'PCX'
Set reference lObjRef to $cinst.$objs.$add(kComponent,"PCX Library","PCX Control",-200,-200,10,10,kFalse,kFalse)
End Switch
Do lObjRef.$visible.$assign(kFalse)
Do method AssignProperties (lObjRef,pProperties)
Calculate as eval('pWindowRef.$assign(lObjRef.$framehwnd)')
If not(pWidthRef)
Calculate as eval('pWidthRef.$assign(lObjRef.$imagewidth)')
End If
If not(pHeightRef)
Calculate as eval('pHeightRef.$assign(lObjRef.$imageheight)')
End If
Do __HtmlCtrlObjsList.$add(pCtrlIdent,lObjRef.$ident)
On evXCompPluginCreate
If pComponentLib="internal"
Set reference lObjRef to $cinst.$objs.$add(eval(pComponentCtrl),-pWidthRef,-pHeightRef,pWidthRef,pHeightRef,kFalse,kFalse)
Else
Set reference lObjRef to $cinst.$objs.$add(kComponent,pComponentLib,pComponentCtrl,-pWidthRef,-pHeightRef,pWidthRef,pHeightRef,kFalse,kFalse)
If pComponentCtrl=$cobj.$componentctrl
Calculate lObjRef.$eventhwnd as $cobj.$framehwnd
End If
End If
Do method AssignProperties (lObjRef,pProperties)
Calculate as eval('pWindowRef.$assign(lObjRef.$framehwnd)')
Do __HtmlCtrlObjsList.$add(pCtrlIdent,lObjRef.$ident)
On evPluginDestroy
Do __HtmlCtrlObjsList.$search(__HtmlCtrlident=pCtrlIdent,kTrue,kFalse,kTrue,kTrue)
Do __HtmlCtrlObjsList.$first(kTrue,kTrue) Returns lSearchRef
While len(lSearchRef)
Do __HtmlCtrlObjsList.$loadcols()
Set reference lObjRef to $cinst.$objs.$findident(__HtmlCtrlObjIdent) ;; get reference to plugin object
Do $cinst.$objs.$remove(lObjRef) ;; remove plugin object from window
Do __HtmlCtrlObjsList.$remove(__HtmlCtrlObjsList) ;; remove object from list
Do __HtmlCtrlObjsList.$first(kTrue,kTrue) Returns lSearchRef
End While
The HTML control will display the HTML file specified in the $filename property.
The file made be a valid HTML file on the local machine or local network.
Do HTMLControlRef.$filename.$assign(FilePath)A numeric adjustment between -3 and 3 to apply to the font size
; Increase font size
If HTMLControlRef.$fontsizeadj<3
Do HTMLControlRef.$fontsizeadj.$assign(HTMLControlRef.$fontsizeadj+1)
End If
; Decrease font size
If HTMLControlRef.$fontsizeadj>-3
Do HTMLControlRef.$fontsizeadj.$assign(HTMLControlRef.$fontsizeadj-1)
End If
Do HTMLControlRef.$getselectedtext(cText)
Sets cText to the text which is currently selected in the document.
Text that is selected by $searchwords is ignored by this method.Converts cPath from the HTML syntax to the syntax for the current platform, and sets cPath to the result.
Do HTMLControlRef.$pathtoapi(cPath)
I haven't figured out where or how I would use this method.Converts cPath from the syntax for the current platform to the HTML syntax, and sets cPath to the result.
Do HTMLControlRef.$pathtothml(cPath)
I haven't figured out where or how I would use this method.Prints the document
Do HTMLControlRef.$printdocument()A space separated list of up to five words which will be highlighted in the displayed document when the document is opened.
The $searchwords property must be set before setting the $filename property, so after you set the $seachwords property you will need to reset the $filename property.
Do HTMLControlRef.$searchwords.$assign(cSearchString)
Do HTMLControlRef.$filename.$assign(irHTMLCtrl.$filename)
Starts scrolling the document once every iInterval milliseconds by the specified units
Do HTMLControlRef.$startanimatescroll(iHorzScrollUnits,iVertScrollUnits,iInterval)
Do HTMLControlRef.$startanimatescroll(0,1,100)
Stops automatic scrolling of the document
Do HTMLControlRef.$stopanimatescroll()If you want to overlay a multi-line entry field with an hmtl view of the same thing with hyperlinks added you run into a problem with the margins shifting. While that xcomp doesn't have any margin control properties, you can compensate in the HTML itself, adding to the opening body tag:
<body topmargin=-10 leftmargin=-1>
You will need to adjust the values for the font and size you use in order to shift the text to align with the scrolling entry field behind the html overlay. Once added you can make the hyperlinks come and go without any shifty glitches.
This tip has been provided by Kelly Burgess and Michael Monschau.The first time I tried to use the timer object it took a while to find because it wasn't loaded. Review the topic on
if the object doesn't show up in your external components treelist.To use the timer object you first create an object class which has the timer object as its superclass.
Once the timer object class is created, you can instantiate it using an object data type variable. Depending on the purpose you can use a task variable, class variable, or instance variable to instantiate your object class which has the timer object as its superclass.
Your
Click the object class will have several properties and methods which are reviewed below. button to open a window which demonstrates an oTimerDemo object class and a technique for adding an observer to a timer object. The observer is notified each time a $timer message is received by the timer object.The timer object $autoreset property can be set to kTrue or kFalse.
If set to kFalse the timer object will send a $timer message once and then stop. If set to kTrue the timer object will continue to send $timer messages at the interval specified by the $timervalue and $useseconds properties until it is sent a $stoptimer message.The timer object $reentrant property can be set to kTrue or kFalse.
If set to kTrue the timer sends a $timer message and immediately restarts the timer without waiting for the $timer method to execute.
If set to kFalse the timer sends a $timer message and waits for the $timer method to complete before restarting the timer.The timer object $useseconds property can be set to kTrue or kFalse.
If set to kTrue the unit of measure for $timervalue will be seconds. If set to kFalse the unit of measure will be milliseconds.Some Omnis developers have reported that a timer object initiated method will crash Omnis Studio if the timer object initiated method kicks in when another Omnis Studio method is executing.
To prevent this from happening you can use the sys(90) function to check the number of methods in the method stack and abort running the timer object method if other methods are running at the same time.
Place the following code at the start of your $timer method:
; Check the number of methods currently in the method stack.
Calculate MethodStackLineCount as sys(90)
If MethodStackLineCount<>1
; A method other than this one is currently running.
; Restart the timer object if it is not $reentrant.
If $cinst.$reentrant=kFalse
Do $cinst.$starttimer()
End If
Calculate FlagOK as kTrue
Else
; No other methods are in the method stack.
; Run the timer object method initiated code.
Breakpoint
End If
Quit method FlagOK
The sys(9) function does not work for web client requests running in a thread of the multi-threaded server.