Template:DGS/OOP: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (little correction)
(Change template for better using)
 
Line 1: Line 1:
<includeonly><u>'''DGS OOP Syntax'''</u> <small>[[OOP Introduction|Help! I don't understand this!]]</small>{{#if: {{{1|}}} |: '''Note''': ''{{{1}}}''|}}{{#if: {{{2|}}} |: '''Method''': {{#if: {{{6|}}} |''[[{{{6}}}|{{#if: {{{7|}}} |''{{{7}}}''|}}]] :'' |}} ''{{{2}}}(...)''|}}{{#if:{{{3|}}} |: '''Event''': {{#if: {{{6|}}} | ''[[{{{6}}}|{{#if: {{{7|}}} | ''{{{7}}}''|}}]]''|DGSElement}} '': on("{{{3}}}", ...)''|}}{{#if: {{{4|}}} |: '''Variable''': ''.{{{4}}}''|}}{{#if: {{{5|}}} |: '''Counterpart''': ''[[{{{5}}}]]''|}}</includeonly><noinclude>{{Template documentation|Template for OOP (object orientated programming)|
<includeonly><u>'''DGS OOP Syntax'''</u> <small>[[OOP Introduction|Help! I don't understand this!]]</small>{{#if: {{{Note|}}} |: '''Note''': ''{{{Note}}}''|}}{{#if: {{{Method|}}} |: '''Method''': {{#if: {{{elementType|}}} |''[[{{{elementType}}}|{{#if: {{{elementName|}}} |''{{{elementName}}}''|}}]] :'' |}} ''{{{Method}}}(...)''|}}{{#if:{{{Event|}}} |: '''Event''': {{#if: {{{elementType|}}} | ''[[{{{elementType}}}|{{#if: {{{elementName|}}} | ''{{{elementName}}}''|}}]]''|DGSElement}} '': on("{{{Event}}}", ...)''|}}{{#if: {{{Variable|}}} |: '''Variable''': ''.{{{Variable}}}''|}}{{#if: {{{Counterpart|}}} |: '''Counterpart''': ''[[{{{Counterpart}}}]]''|}}</includeonly><noinclude>{{Template documentation|Template for OOP (object orientated programming)|
==<span style="color:#000000;text-shadow:0.05em 0.05em 0.2em #00000099;">Syntax</span>==
==<span style="color:#000000;text-shadow:0.05em 0.05em 0.2em #00000099;">Syntax</span>==
<syntaxhighlight lang="lua">{{DGS/OOP|NOTE|METHOD|EVENT|VARIABLE|COUNTERPART|ELEMENT_TYPE|ELEMENT_NAME}}</syntaxhighlight>
<syntaxhighlight lang="lua">
{{DGS/OOP|
    Note = ?|
    Method = ?|
    Event = ?|
    Variable = ?|
    Counterpart = ?|
    elementType = ?|
    elementName = ?
}}
</syntaxhighlight>


==<span style="color:#000000;text-shadow:0.05em 0.05em 0.2em #00000099;">For functions</span>==
==<span style="color:#000000;text-shadow:0.05em 0.05em 0.2em #00000099;">For functions</span>==
{{DGS/OOP|This function creates a 3d interface in the world.|dgs3DInterface||}}
{{DGS/OOP|
<syntaxhighlight lang="lua">{{DGS/OOP|This function creates a 3d interface in the world.|dgs3DInterface||}}</syntaxhighlight>
    Note = This function creates a 3d interface in the world. |
    Method = dgs3DInterface |
}}
<syntaxhighlight lang="lua">
{{DGS/OOP|
    Note = This function creates a 3d interface in the world.|
    Method = dgs3DInterface
}}
</syntaxhighlight>


{{DGS/OOP||DGSElement:setText||text|dgsGetText}}
{{DGS/OOP|
<syntaxhighlight lang="lua">{{DGS/OOP||DGSElement:setText||text|dgsGetText}}</syntaxhighlight>
    Method = DGSElement:setText|
    Variable = text|
    Counterpart = dgsGetText
}}
<syntaxhighlight lang="lua">
{{DGS/OOP|
    Method = DGSElement:setText|
    Variable = text|
    Counterpart = dgsGetText
}}
</syntaxhighlight>


{{DGS/OOP|This function is used to create columns in grid lists.|addColumn|||dgsGridListRemoveColumn|dgs-dxgridlist|DGSGridList}}
{{DGS/OOP|
<syntaxhighlight lang="lua">{{DGS/OOP|This function is used to create columns in grid lists.|addColumn|||dgsGridListRemoveColumn|dgs-dxgridlist|GridList}}</syntaxhighlight>
    Note = This function is used to create columns in grid lists.|
    Method = addColumn|
    Counterpart = dgsGridListRemoveColumn|
    elementType = dgs-dxgridlist|
    elementName = GridList
}}
<syntaxhighlight lang="lua">
{{DGS/OOP|
    Note = This function is used to create columns in grid lists.|
    Method = addColumn|
    Counterpart = dgsGridListRemoveColumn|
    elementType = dgs-dxgridlist|
    elementName = GridList
}}
</syntaxhighlight>


==<span style="color:#000000;text-shadow:0.05em 0.05em 0.2em #00000099;">For events</span>==
==<span style="color:#000000;text-shadow:0.05em 0.05em 0.2em #00000099;">For events</span>==
{{DGS/OOP|This event is triggered each time a DGS element gains input focus||dgsFocus}}
{{DGS/OOP|
<syntaxhighlight lang="lua">{{DGS/OOP|This event is triggered each time a DGS element gains input focus||dgsFocus}}</syntaxhighlight>
    Note = This event is triggered each time a DGS element gains input focus|
    Event = dgsFocus
}}
<syntaxhighlight lang="lua">
{{DGS/OOP|
    Note = This event is triggered each time a DGS element gains input focus|
    Event = dgsFocus
}}
</syntaxhighlight>


{{DGS/OOP|This event is triggered when enter is pressed on a dgs edit box.||dgsEditAccepted|||dgs-dxedit|DGSEditBox}}
{{DGS/OOP|
<syntaxhighlight lang="lua">{{DGS/OOP|This event is triggered when enter is pressed on a dgs edit box.||dgsEditAccepted|||dgs-dxedit|DGSEditBox}}</syntaxhighlight>
    Note = This event is triggered when enter is pressed on a dgs edit box.|
    Event = dgsEditAccepted|
    elementType = dgs-dxedit|
    elementName = DGSEditBox
}}
<syntaxhighlight lang="lua">
{{DGS/OOP|
    Note = This event is triggered when enter is pressed on a dgs edit box.|
    Event = dgsEditAccepted|
    elementType = dgs-dxedit|
    elementName = DGSEditBox
}}
</syntaxhighlight>


Hey guys, here are a few "rules" in using the OOP template:
Hey guys, here are a few "rules" in using the OOP template:

Latest revision as of 18:48, 3 May 2021

Applications-office.pngTemplate Documentation

Template for OOP (object orientated programming)

Usage

Syntax

{{DGS/OOP|
    Note = ?|
    Method = ?|
    Event = ?|
    Variable = ?|
    Counterpart = ?|
    elementType = ?|
    elementName = ?
}}

For functions

DGS OOP Syntax Help! I don't understand this!

Note: This function creates a 3d interface in the world.
Method: dgs3DInterface(...)
{{DGS/OOP|
    Note = This function creates a 3d interface in the world.|
    Method = dgs3DInterface
}}

DGS OOP Syntax Help! I don't understand this!

Method: DGSElement:setText(...)
Variable: .text
Counterpart: dgsGetText
{{DGS/OOP|
    Method = DGSElement:setText|
    Variable = text|
    Counterpart = dgsGetText
}}

DGS OOP Syntax Help! I don't understand this!

Note: This function is used to create columns in grid lists.
Method: GridList : addColumn(...)
Counterpart: dgsGridListRemoveColumn
{{DGS/OOP|
    Note = This function is used to create columns in grid lists.|
    Method = addColumn|
    Counterpart = dgsGridListRemoveColumn|
    elementType = dgs-dxgridlist|
    elementName = GridList
}}

For events

DGS OOP Syntax Help! I don't understand this!

Note: This event is triggered each time a DGS element gains input focus
Event: DGSElement : on("dgsFocus", ...)
{{DGS/OOP|
    Note = This event is triggered each time a DGS element gains input focus|
    Event = dgsFocus
}}

DGS OOP Syntax Help! I don't understand this!

Note: This event is triggered when enter is pressed on a dgs edit box.
Event: DGSEditBox : on("dgsEditAccepted", ...)
{{DGS/OOP|
    Note = This event is triggered when enter is pressed on a dgs edit box.|
    Event = dgsEditAccepted|
    elementType = dgs-dxedit|
    elementName = DGSEditBox
}}

Hey guys, here are a few "rules" in using the OOP template:

  • If it's a constructor, such as createPed, use "Ped" not "createPed" or "Ped.create"
  • If it's a static class function or a constructor, use a capital letter for the first character. (Player not player).
  • Likewise, if it's an object function such as "player:setName", use lowercase.
  • Use full stops (or if you're american, "periods.") for static functions and colons (:) for object functions.