Difference between revisions of "Text Tips"

From FM Plugin Wikipedia
Jump to: navigation, search
 
(12 intermediate revisions by 3 users not shown)
Line 6: Line 6:
 
This page is about editing text passed from FileMaker to your plugin.
 
This page is about editing text passed from FileMaker to your plugin.
  
 +
=Text Public Functions=
 +
*[[ulong GetSize() const]]
  
==Compare dataVect Text Value==
 
I have found the following function useful for easy compare of a dataVect against a pre-defined text field.
 
  
bool DataVectCompare(const fmx::DataVect& dataVect, long index, char * compare )
+
*[[void Assign ( const char *s, Encoding encoding = kEncoding_Native )]]
//takes the passed DataVect and compares it against the fixed string passed, returns TRUE is they are the same.  (Not case sensitive)
+
*[[void AssignWide ( const wchar_t *s )]]
// eg.  DataVectCompare(dataVect, 0,  "something")  returns  TRUE is dataVect.AtAsText(0) == "something"
+
*[[void AssignUnicode ( const ushort *s )]]
{
 
fmx::TextAutoPtr dv;
 
dv->SetText( dataVect.AtAsText(index) ); // get the contents of the specified parameter.
 
dv->Lowercase(); // and convert to all 'lowercase' for checking.
 
 
fmx::TextAutoPtr    cs;
 
cs->Assign(compare); // take the passed 'Compare' string
 
cs->Lowercase(); // and convert to all Lowercase for checking.
 
 
return ( *dv == *cs );
 
 
} // DataVectCompare
 
  
  
Then, in any script where you want to compare the text passed by the user, you can include...
+
*[[void AssignWithLength ( const char *s, ulong strlength, Encoding encoding = kEncoding_Native )]]
 +
*[[void AssignWideWithLength ( const wchar_t *s, ulong strlength )]]
 +
*[[void AssignUnicodeWithLength ( const ushort *s, ulong strlength )]]
  
if ( DataVectCompare(dataVect,0, "Text") )
+
 
{
+
*[[void GetBytes ( char *charbuffer, ulong buffersize, ulong position = 0, ulong size = kSize_End, Encoding encoding = kEncoding_Native ) const]]
// Do something only if first parameter (index = 0) passed is equal to  'Text'
+
 
}
+
 
 +
*[[void GetUnicode ( ushort *unicodebuffer, ulong position, ulong size ) const]]
 +
 
 +
 
 +
*[[void SetText ( const Text &other, ulong position = 0, ulong size = kSize_End )]]
 +
*[[void AppendText ( const Text &other, ulong position = 0, ulong size = kSize_End )]]
 +
*[[void InsertText ( const Text &other, ulong position )]]
 +
*[[void DeleteText ( ulong positionToDelete, ulong sizeToDelete = kSize_End )]]
 +
 
 +
 
 +
*[[ulong Find ( const Text &other, ulong position ) const]]
 +
*[[ulong FindPrev ( const Text &other, ulong position ) const]]
 +
*[[ulong FindIgnoringCase ( const Text &other, ulong position ) const]]
 +
*[[ulong FindPrevIgnoringCase ( const Text &other, ulong position ) const]]
 +
 
 +
 
 +
*[[void Uppercase ()]]
 +
*[[void Lowercase ()]]
 +
 
 +
 
 +
*[[void GetStyle( CharacterStyle& style, ulong position ) const]]
 +
*[[void GetDefaultStyle( CharacterStyle& style ) const]]
 +
 +
 
 +
*[[void SetStyle( const CharacterStyle& style, ulong position = 0, ulong size = kSize_End )]]
 +
 
 +
 
 +
*[[void RemoveStyle( const CharacterStyle& style )]]
 +
 
 +
 
 +
*[[void ResetAllStyleBuffers()]]
 +
 
 +
 
 +
*[[bool operator == ( const Text &that ) const]]
 +
*[[bool operator != ( const Text &that ) const]]
 +
*[[bool operator less ( const Text &that ) const]]
 +
*[[bool operator less= ( const Text &that ) const]]
 +
*[[bool operator gtr ( const Text &that ) const]]
 +
*[[bool operator gtr= ( const Text &that ) const]]
 +
 
 +
 
 +
*[[void operator delete ( void *obj )]]
 +
 
 +
=Example Text Functions=
 +
 
 +
===Compare dataVect Text Value===
 +
I have found the following function useful for easy compare of a dataVect against a pre-defined text field. [[dataVectCompare]]

Latest revision as of 10:00, 24 June 2009


This page is about editing text passed from FileMaker to your plugin.

Text Public Functions














Example Text Functions

Compare dataVect Text Value

I have found the following function useful for easy compare of a dataVect against a pre-defined text field. dataVectCompare