HOME | SIMPLE GRID | DEMO | BUY NOW |
SimpleTools (c) 2002-2006 Octatec Ltd | |
IntroductionThis is a set of OCXs and Automation Objects intended to make your programming tasks much simpler. They can be used by VisualBasic, C++, EXCEL/VBA, or any language that understands Active X (COM).
SimpleTree (see code sample)This is an OCX wrapper for the standard Tree control. It is exceptionally easy to use and allows you to add trees to your dialog-based applications very quickly. Being a simplification of the general Tree interface, not all Tree functionality is present, but that is not a limiting factor, as, you can Post or Send messages directly to the underlying HWND via specific methods and so access more advanced functionality that is not exposed directly by the control.
SimpleTable (see code sample)This OCX is a wrapper for the standard List control (in report mode). It allows you to present data in a tabular form. It is not grid control, however, and does not support in-place editing of items, individual cell colours, etc. For a fully-fledged grid control iwth all these features, see SimpleGrid. Like the SimpleTree, the SimpleTable provides Post and Send methods so you can access more advanced functionality of the underlying List control if you need to.
SimpleURL (see code sample)This OCX has 2 properties, a URL path the DisplayText. With this control you can enter clickable text links directly on your dialog that will take you to the Internet or display a local file. You can set the Font, Text and Background colours of the DisplayText. In the example below, the control is only the underlined text "Octatec Web Site"
SimpleTextMarkup (see code sample)This is a more flexible than the SimpleURL control. This control allows you to create a block of text, and selectively ‘markup’ various parts of it. E.G. you can make change the colour and or font of words, make words clickable, make words underlined etc. When clickable words are clicked, you receive an event notifying you of this and you can display a URL or take some other appropriate action. In the example below, the control is the whole of the text block.The text can be ‘marked-up’ using API
calls
on character positions or by setting the control with a HTML-like
string
SimpleTimer (see code sample)This is a very simple timer object that fires a TimerTick event at regular intervals. This gives you easy access to Timer functionality from environments that dont normally provide it. You can keep the timer invisible, or display its very simple image if you wish.SimpleLine (see code sample)This OCX simply lets you add lines (horizontal or vertical, 3D or flat) to your dialog. It is an extremely simple facility, but it is not so straight forward to do without this control (especialy in C++ based dialogs). It can be used in conjunction with the SimpleURL to make your dialog boxes more interesting.SimpleFolderSelect (see code sample)This is an automation object, not an OCX. It displays a tree-based dialog from where you can select a folder. As its name suggests, it is intended to allow you to select folders (rather than files) from the file system.
DateTime API (see code sample)This COM Automation Object provides a rich set of methods for manipulating dates. The class encapsulates the OLE/VB DATE type. The object is particularly good at comparing dates and adding various units to the date, e.g. AddDays, AddMonths, AddMinutes etc. When the object is created, it is initialized to Midnight 1/1/2001. Unlike the other objects in this package, this object does not depend on the MFC DLL.VBA Code SamplesThe package comes with a Sample C++ application that uses all the controls, and an EXCEL spread sheet that also uses the controls. The code sample here is just a fragment, to give you an idea of how easy the controls are to use.SimpleTreeThis code shows initialization, events are triggered when items are selected, double-clicked etc.Private Sub InitTree_Click()
SimpleTree1.ExpandItem (idroot)
SimpleTableThis code shows initialization, events are triggered when items are selected, double-clicked etc.Private Sub InitTable_Click()
Call
SimpleTable1.AddPropotionateColumn("col1",
3, True)
Call SimpleTable1.AppendRow(-1, 0)
Call SimpleTable1.SetCellText(0, 0,
"0,0")
Call SimpleTable1.SetCellText(1, 0,
"1,0")
SimpleURLNo code is required for this control, events are triggered when the the URL is selected, but you need not respond to them. You simply set the URL and DisplayText proerties.SimpleTextMarkupPrivate Sub Init_STMup_Click() 'a buton click to initialize the Simple Text Markup control,'could also be done as part of general application initialization SimpleTextMarkup1.Text = "Please click
here to
visit the Octatec web site"
Dim l1 As Long ' start - zero based
Call SimpleTextMarkup1.Find(l1, l2,
"here", 1)
Call SimpleTextMarkup1.Find(l1, l2,
"Octatec",
1)
Call SimpleTextMarkup1.Find(l1, l2,
"Octatec
web site", 1)
End Sub Private Sub SimpleTextMarkup1_OnItemClick(ByVal clickID As
Long,
ByVal Text As String)
SimpleTimerPrivate Sub StartTimer_Click()SimpleTimer1.SetTimerInterval 1 ' 1 second SimpleTimer1.Start End Sub Private Sub StopTimer_Click()
SimpleLineNo code is required for this control, and no events are triggered, you simply set the Vertical/Horizontal/3D properties.SimpleFolderSelectPrivate Sub SelectFolder_Click()Dim folderSelect As Object Set folderSelect = CreateObject("SimpleFolderSelect") folderSelect.SetInitialDir ("c:\program
files")
ok = folderSelect.DoModal
DateTime APIPrivate Sub DateTimeTest_Click()Dim dateTime1 As Object Set dateTime1 = CreateObject("DateTime.API") s = dateTime1.FormatDateTime MsgBox "Date1 Initial Value " & s ' this is 1/1/2001 00:00:00 Dim dateTime2 As Object
MsgBox "Date2 Value " & s If
(dateTime2.IsGT(dateTime1.GetDate())) Then
dateTime1.SetNow
MsgBox "56 days from now is: " & s
Method ListSimpleTreeSimpleTree Methodslong AddRoot(BSTR name, long imageId, boolean boldFont,
long
userData);
long AddBranch(long parent, BSTR name, long imageId,
boolean
boldFont, long userData);
long AddImage(long bitmapResourceId);
long AddImageFromFile(BSTR bitmapFile);
void MakeItemBold(long itemId, boolean boldMode)
void ChangeImage(long itemId, long imageId)
boolean ExpandItem(long itemId);
boolean SelectItem(long itemId);
long GetSelectedItem();
void DeleteAllItems();
boolean DeleteItem(long itemId);
BSTR GetItemText(long itemId)
long GetItemUserData(long itemId);
boolean Walk(long startItemID);
long GetHWND();
boolean PostMessage(long msg, long wparam, long lparam);
SimpleTree Events void ItemSelected(long itemId, BSTR name, long imageId,
long
userData);
void ItemDoubleClick(long itemId, BSTR name, long
imageId, long
userData);
void ItemRightClick(long itemId, BSTR name, long
imageId, long
userData);
long VisitTreeItem(long itemID, BSTR name, long
imageID, long
userData, long depth, BSTR path, long* outputIndicator);
SimpleTableMethodsvoid EnableFullRowSelect(boolean mode);
void EnableGridLines(boolean mode);
void EnableMovableColumns(boolean mode);
void AddPropotionateColumn(BSTR title, long
proportionateWidth,
boolean leftJustified);
BOOL AddPercentageColumn(BSTR title, long
percentageWidth, BOOL
leftJustify);
void AddColumn(BSTR title, long width, long
leftJustified);
long AddImage(long bitmapResourceId);
long AddImageFromFile(BSTR bitmapFile);
long AppendRow(long imageId, long userData);
boolean SetCellText(long row, long col, BSTR text);
BSTR GetCellText(long row, long col);
void void DeleteRow(long rowIndex);
void DeleteAllRows();
long GetSelectedRow();
long GetRowUserData(long row);
long GetColumnCount();
boolean PostMessage(long msg, long wparam, long lparam);
long GetHWND();
Simple Table Events void RowSelected(long rowIndex, long imageId, long
userData);
void RowDoubleClick(long rowIndex, long imageId, long
userData);
void RowRightClick(long rowIndex, long imageId, long
userData);
void ColumnClick(long columnIdex, BSTR columnTitle);
SimpleURLThe SimpleURL control just allows to position a clickable-strings on your dialog. This control allows you to position blocks of text in you dialog. The blocks of text can contain clickable strings, and text of differing fonts/sizes/colours just like HTMLProperties BSTR url;
BSTR displayText;
Methods void SetColours(long rgbNormal, long rgbVisited, long
rgbActive);
void SetBackgroundColour(long rgbValue);
void SetFont(long pointSize, BSTR fontName);
void SetPosition(long top, long left, long bottom, long
right);
boolean DisplayURL(BSTR url);
Events void OpenURL(BSTR url, BSTR displayText, long*
outputIndicator);
SimpleTextMarkupPropertiesshort BorderStyle This property controls the border...
This property needs to be set before calling any methods. BSTR Text This property sets the text of the control, you should set this (or call SetFromHypertext() ) before using other methods Methods boolean Find(long* start, long* length, BSTR text, long placement); Find a particular string in the control, the 0-based staring position and length of the string are returned. The placement parameter allows you to specify the placement of the string to find i.e. which occurrence of a particular string to locate, e.g. in the string "This is very very long text", to find the 2nd occurrence of very, set the placement value to 2, and make the call Find(pstart, plen, "very", 2).This method is provided to make the calls to the Markup… methods easier. NB: as an alternative to using the Markup... methods, you can use SetFromHypertext() boolean MarkupClickable(long
start, long
length, long clickID);
NB: in any of the Markup… methods the length parameter can be specified as -1 indicating the end of the text. boolean MarkupBold(long start, long length);
Make the specified text Bold, Italic or Underlined. One or more Markup methods can be called on the same text to add to the Markup attributes of the text boolean MarkupTextColour(long start, long length, long rgbColour); Make the text a specified colour, rgbColour is a standard RGB value boolean MarkupFontFace(long start, long length, BSTR faceName); Set the font-face for the specified text. The font-face parameter is a string such as "Arial", "Times New Roman", "Courier New" etc. boolean MarkupFontHeight(long start, long length, long tenthsOfPoint); Set the font-height for the specified text. The font-height parameter is compatibikle with the size value in CreatePointFont. I.e. Character height in 10ths of a point. NB: the underlying RichEditCtrl specifies char height in twips - a twip is 1/1440 of an inch, or 1/20 of a printer's point. i.e. the input measure here is in units of 2 twips, 2/20 of a printer's point. boolean MarkupClear(long start, long length); Clear all attributes for the specified character range void MarkupClearAll(); Clear all attributes for all text void
SetClickableColours(long
rgbNormal, long rgbVisited, long rgbActive);
boolean SetFromHypertext(BSTR hyperText); If you don't like calling the Markup… methods repeatedly to set the properties of the text, you can set all Markups via a HyperText string. The format of the HyperText is very similar to HTML, but slightly simplified. The format is specified below. boolean DisplayURL(BSTR url); This method can be used to display a WWW url, such as "http://www.octatec.co.uk" void SetUrlPosition(long top, long left, long bottom, long right); If you call DisplayURL(BSTR url) the URL will be displayed in a new window, you can call this before DisplayURL(BSTR url) to set the size and location of the URL window void SetBackgroundColor(long rgbColour); Set the background colour of the control, by default, this is white. void EnableSelectableText(BOOL mode) By default, the control does not allow the text to be selected, this method can be called to enbable selectable text (Conrol-C then copies the text to the clipboard) Events void OnItemClick(long clickID, BSTR text);
Clickable (Anchor) <a> The basic format of a clickable anchor is <a
numeric-id>text</a>,
E.G <a 100>click me</a>
Italic <i> <i>text</i> Bold <b> <b>text</b> Text Colour <c> <c r:g:b >text</c> OR
Where r:g:b specifies the RGB values, and 0xXXXXXXXX also specifies the RGB value, but in hex. Font Face <f> The basic format of a font-face directive is <f font-name>text</f>, E.G <f Times New Roman>text</f> Font Height <z> The basic format of font-size directive is <z font-size>text</z> text</f>, E.G <z 110>text</z> LPCTSTR ht = "<b>This is a <c
255:0:0><z 140><f
Times New Roman>test</f></z></c></b>\r\n"
m_simpleTextMarkup.SetFromHypertext(ht); SimpleTimerMethodsThe mthod names for this object fully describe their function... void SetTimerInterval(long seconds);
boolean Start();
Events void TimerTick()
SimpleLinePropertiesboolean VerticalLine;
boolean Line3D;
Methods void SetBackgroundColour(long rgbValue);
void SetLineColour(long rgbValue);
SimpleFolderSelectObject Name: "SimpleFolderSelect"Methods void SetInitialDir(BSTR folderName);
void IncludeRemovableDrives(boolean mode);
void NonexistantDirNotAllowed();
void NonexistantDirWarn();
void NonexistantDirSilent();
void ReadOnlyEditBox(boolean mode);
void SetTitle(BSTR title);
void EnableInitialPathLoad(boolean initalPathLoad);
void EnableRootLoad(boolean rootLoad);
long DoModal();
BSTR GetPath();
DateTime APIObject name: "DateTime.API"Methods Mostly, the method names are self explanitory void SetDate(DATE date);
void SetNow();
long SetDay(short day);
short GetDay();
DATE GetDate();
BSTR GetMonthName();
BSTR GetDayOfWeek();
short GetJulian();
short GetDaysInMonth(short month);
void AddDays(short numDays);
long IsLeapYear(short year);
void SetFromTime_t(long time);
BSTR FormatDateTime();
BSTR FormatDateUS();
BSTR FormatDateUK();
BSTR FormatTime();
long IsEQ(DATE date);
void SetDatePart(short day, short month, short year,
long* ok);
Distributing the OCXs and the Automation ObjectsYou can distribute the .OCX and the .DLL files without restriction. The OCXs will not work in design mode unless you have installed the full SimpleTools package, but they will work as normal at run-time allowing you to distribute any applications you write that uses them.If your applicatons use the DateTimeClass or the SimpeFolderSelect, you must also distribute a Run-Time licence for these 2 objects. You do this by running the ToolsRTL program (which somes with the simple tools package) on any system that you wish to use the DateTimeClass or the SimpleFolderSelect. The usage is: simply ToolsRTL.exe, running this will install an RTL 'run-time' licence on the current machine. (ToolsRTL.exe is not supplied with the demo version) If you are creating setup programs or Installation utilities,
you may
be interested in Octatec's InstallScript
system
which allows you to create setup programs embedded in
self-extracting
archives very easily and quickly.
|