Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
FC Справочник.doc
Скачиваний:
1
Добавлен:
01.07.2025
Размер:
348.67 Кб
Скачать

Свойства

IsAltPressed

Indicate if the ALT touch is pressed

Возвращает - "Истина" или "Ложь"

IsControlPressed

Indicate if the CTRL touch is pressed

Возвращает - "Истина" или "Ложь"

IsShiftPressed

Indicate if the SHIFT touch is pressed Укажите, прессовано ли соприкосновение СДВИГА

Возвращает - "Истина" или "Ложь"

LastReceivedKey

Возвращает полученную последнюю клавишу из графического окна

Возвращает – Название клавиши

FCSettings

This class provides support for settings in your applications

Свойства

SettingFile()

Операции

ClearAll()

Deletes all property of the setting file

Get(PropertyName)

Return the value of the 'PropertyName' property in the setting file.

PropertyName - The property name

Возвращает - The value of the property, or ""

Set(PropertyName,StrValue)

Return the value of the 'PropertyName' property in the setting file.

PropertyName - The property name

StrValue - The value of the property, or "" to delete the property

FCXml

This class provides support for XML documents

Example

Here's an exemple how to use this object.

Code

'OBJECTIVE: Show the title of a well-formed XHTML page

'Load an XML document

XmlDoc = Xml.LoadXMLFile("MyPage.xhtml")

'Find the TITLE element

TitleElement = Xml.GetNode(XmlDoc, "//head/title")

'Show its text content

TextWindow.WriteLine(Xml.GetInnerText(TitleElement))

Операции

CloseDocument(DocH)

Close a document and free the memory used by this document

DocH - The document to delete from memory

DeleteNode(Node)

Delete a node from the document

Node - The node to delete

GetAttribute(NodeName,AttributeName)

Try to retreive the value of a node's attribute

NodeName - The node

AttributeName - The attribute's name

Возвращает - The value of the attribute

GetInnerText(NodeName)

Return the specified property of the node

NodeName - The node from which we look for the property

Возвращает - The value of the property

GetInnerXML(NodeName)

Return the specified property of the node

NodeName - The node from which we look for the property

Возвращает - The value of the property

GetNode(DocumentOrNode,XPath)

Return the first node that match the XPath query, as a native object

DocumentOrNode - The document or node from which the search starts

XPath - The XPath query to a node

Возвращает - The matching node, as a native object

GetNodeName(NodeName)

Return the specified property of the node

NodeName - The node from which we look for the property

Возвращает - The value of the property

GetNodes(DocumentOrNode,XPath)

Save all the elements matching the XPath query in an array, as native objects

DocumentOrNode - The document or node from which the search starts

XPath - The XPath query to the nodes

Возвращает - The array containing all matching elements

GetNodeValue(NodeName)

Return the specified property of the node

NodeName - The node from which we look for the property

Возвращает - The value of the property

GetOuterXML(NodeName)

Return the specified property of the node

NodeName - The node from which we look for the property

Возвращает - The value of the property

InsertCopyOfNode(NewParentNode,NodeToCopy,Position)

Append a new child to an existing node

NewParentNode - The new parent node

NodeToCopy - The node to add in the new parent node

Position - -1 or the position of the new child in the parent

LoadXMLFile(FileName)

Create an XML document from a file

FileName - The location of your XML file

Возвращает- An XML document, as native object

LoadXMLString(XML)

Create an XML document from a XML string

XML - A string containing an XML document

Возвращает - An XML document, as a native object

SaveDocument(DocH,FileName)

Save an XML document into a file

DocH - The document, as a native object

FileName - The file where to save the document

Возвращает - "Истина"/"Ложь"

SetAttribute(NodeName,AttributeName,AttributeValue)

Try to set the value of a node's attribute

NodeName - The node

AttributeName - The attribute's name

AttributeValue- The new value

SetInnerText(NodeName,Value)

Set the specified property of the node

NodeName - The node from which we look for the property

Value - The value of the property

SetInnerXML(NodeName,Value)

Set the specified property of the node

NodeName - The node from which we look for the property

Value - The value of the property

SetNodeValue(NodeName,Value)

Set the specified property of the node

NodeName- The node from which we look for the property

Value- The value of the property

Samples

First sample : the Controls extension (and others)

' Init variables

Timer = ""

' Init Window

GraphicsWindow.Show()

GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(240,240,240)

Controls.LoadTheme("Vista")

' Create animation

MyImage = Controls.AddImage("AppIcon.png")

ButtonClick()

' Create button

MyButton = Controls.AddButton(150, 22, "Start/Stop")

Controls.Move(MyButton, 5, 150)

Controls.RegisterMouseUpEvent(MyButton, "ButtonClick")

' Create textbox

MyTextBox = Controls.AddTextBox(175, 22, "")

Controls.Move(MyTextBox, 165, 150)

Controls.SetText(MyTextBox, "Some text")

Controls.RegisterEvent(MyTextBox, "TextChangedEvent", "OnTextChange")

' Create checkbox

MyCheckBox = Controls.AddCheckBox("Cliquez ici !")

Controls.Move(MyCheckBox, 350, 155)

Controls.SetChecked(MyCheckBox, "True")

' Subs

CurrentMyImageRotation = 0

To150 = "False"

Sub RotateMyImage

CurrentMyImageRotation = CurrentMyImageRotation + 1

If CurrentMyImageRotation = 360 Then

CurrentMyImageRotation = 0

If To150 = "False" Then

To150 = "True"

Controls.MoveAsAnimation(MyImage, 0, 0, 1080)

Else

To150 = "False"

Controls.MoveAsAnimation(MyImage, GraphicsWindow.Width-125, 0, 1080)

EndIf

EndIf

Controls.SetRotationAngle(MyImage, CurrentMyImageRotation)

EndSub

Sub ButtonClick

If Timer = "" Then

Timer = SmallBasic.SetInterval("RotateMyImage", 3, -1)

GraphicsWindow.AnimateShape(MyImage, GraphicsWindow.Width-125, 0, 1080)

Else

SmallBasic.AsyncStop(Timer)

Timer = ""

EndIf

EndSub

Take advantage of profession resume and you will obtain position you strive for

Sub OnTextChange

GraphicsWindow.ShowMessage(Controls.GetText(MyTextBox),"Text")

EndSub

Second sample : XML

TextWindow.WriteLine("Test du système XML")

Quote = Text.GetCharacter(34)

Doc = Xml.LoadXMLFile("Data.XML")

TextWindow.WriteLine("")

' First test

Bag2 = Xml.GetNode(Doc, "//bag[2]")

TextWindow.WriteLine("The element : " + Bag2)

TextWindow.WriteLine("Content of the element : " + Xml.GetOuterXML(Bag2))

TextWindow.WriteLine("")

' Second test

ItemE = Xml.GetNode(Bag2, "./item[@name="+Quote+"e"+Quote+"]")

TextWindow.WriteLine("The element : " + ItemE)

Name = Xml.GetNodeValue(Xml.GetNode(ItemE, "@name"))

TextWindow.WriteLine("Name of the element : " + Quote + Name + Quote)

TextWindow.WriteLine("")

Sample 3 : Interop

Args[0] = "Bonjour "

Builder = Interop.CreateObject("System.Text.StringBuilder",Args)

ClearArgs()

Args[0] = "Objet StringBuilder créé !"

Args[1] = "My TestApp for Interop"

Interop.CallSharedSub("System.Windows.Forms.MessageBox", "Show", Args)

ClearArgs()

TextWindow.Write("Entrez votre nom ici : ")

Args[0] = TextWindow.Read()

Interop.CallSub(Builder, "Append", Args)

ClearArgs()

Args[0] = "L'objet StringBuilder semble avoir fonctionné correctement"

Args[1] = "My TestApp for Interop"

Interop.CallSharedSub("System.Windows.Forms.MessageBox", "Show", Args)

ClearArgs()

TextWindow.WriteLine(Interop.ToString(Builder))

Sub ClearArgs

Args = ""

EndSub

Reliable custom term paper and professional assistance are your assistants 24/7!

Sample 4 : Drawings and curve generator

GraphicsWindow.Show()

GraphicsWindow.BackgroundColor = "#FFEEDD"

' Closed curve points

Arr1[0]["X"] = 10

Arr1[0]["Y"] = 10

Arr1[1]["X"] = 10

Arr1[1]["Y"] = 40

Arr1[2]["X"] = 40

Arr1[2]["Y"] = 40

Arr1[3]["X"] = 40

Arr1[3]["Y"] = 10

' Normal curve points

Arr2 = Arr1

Arr2[4]["X"] = 10

Arr2[4]["Y"] = 10

' Create the graphics

MyCurve = FCDrawings.CreateGraphics(50,50)

MyPicture = FCDrawings.CreateGraphics(50,50)

' Draw the curves

FCDrawings.DrawCurve(MyCurve, "Blue", 3, Arr2)

FCDrawings.DrawClosedCurve(MyPicture, "Red", 3, Arr1)

' Generate the images to use in the Graphics Window

MyCurve = FCDrawings.GenerateImage(MyCurve)

MyPicture = FCDrawings.GenerateImage(MyPicture)

Shapes.Move(Shapes.AddImage(MyPicture), 50, 0)

Shapes.Move(Shapes.AddImage(MyCurve), 0, 0)

GraphicsWindow.ShowMessage("THE END!",":)")

Needs a file called AppIcon.png in the same directory as the *.sb

GraphicsWindow.Show()

G = Drawings.CreateGraphics("AppIcon.png")

Drawings.DrawLine(g, "Red", 5, -10,-10,50,50)

Pts[0]["X"] = (5)

Pts[0]["Y"] = (5)

Pts[1]["X"] = (25)

Pts[1]["Y"] = (10)

Pts[2]["X"] = (45)

Pts[2]["Y"] = (40)

Drawings.DrawCurve(g, "Green", 3, Pts)

Drawings.DrawEllipse(g, "Blue", 3, 5, 5, 60, 75)

Drawings.DrawRectangle(G, "Yellow", 3, 40, 40, 20, 20)

I = Drawings.GeneratePartialImage(g, 5, 5, 60, 75)

Drawings.ReleaseGraphics(g)

GraphicsWindow.Title = I

Controls.AddImage(I)

G = Drawings.CreateGraphics(I)

Drawings.SaveGraphicsToFile(G, "Result.png")

Drawings.ReleaseGraphics(g)

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]