Knowledgebase:
SetListSubItem
Posted by Mohammad Rahhal, Last modified by Rawan Al Hourani on 18 July 2017 02:50 PM

Syntax

Public Function SetListSubItem(formID As String, ListName As String, actionType As ENUM_GUI_LIST_SUBITEM_ACTION, Key As String, Text As String, indexSubItem As Integer) As Boolean

This function is used to add or update subitem in list view according to a given actionType.

Parameters

Key  Description 
formId Form identifier, must be a number greater than 3000 and less than 10,000.
ListName List identifier, value of type String.
actionType Value can be one of the ENUM_GUI_LIST_SUBITEM_ACTION
Key The key of the list view item which contains the desired subitem, value of type String.
Text The subitem text, value of type String.
indexSubItem The index of the subitem, value of type Integer

Return value

Returns true if the specified list view subitem data has been set. Otherwise, returns false. In order to get an error, call GetLastError() function.

Sample


Public Sub Main()

Dim frmID

 frmID = 3600
CreateVTLForm Clng(frmID) , false, "CAPTION"

CreateVTLControl Cstr(frmID) , "MyList", GUI_LIST_VIEW
SetGUIObject CSTR(frmID),CSTR("MyList"),GUI_PROPERTY_BACK_COLOR,Clng(RGB(190,101,190))
SetGUIObject CSTR(frmID),"",GUI_PROPERTY_HEIGHT, 6000
SetGUIObject CSTR(frmID),"",GUI_PROPERTY_WIDTH, 13000
SetGUIObject CSTR(frmID),"",GUI_PROPERTY_LEFT, 100
SetGUIObject CSTR(frmID),"",GUI_PROPERTY_TOP, 100

SetGUIObject CSTR(frmID),CSTR("MyList"),GUI_PROPERTY_HEIGHT, 2000
SetGUIObject CSTR(frmID),CSTR("MyList"),GUI_PROPERTY_WIDTH,12000
SetGUIObject CSTR(frmID),CSTR("MyList"),GUI_PROPERTY_TOP,400

for i = 1 to PositionTotal
         SetListViewAction CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_LISTITEM, Cstr(i)
next

SetListViewAction CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_COLUMN, "1","TicketNo"
SetListViewAction CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_COLUMN, "2","Date"
SetListViewAction CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_COLUMN, "3","Type"
SetListViewAction CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_COLUMN, "4","Amount"
SetListViewAction CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_COLUMN, "5","Sympol"
SetListViewAction CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_COLUMN, "6","OpenPrice"
SetListViewAction CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_COLUMN, "7","S/L"
SetListViewAction CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_COLUMN, "8","T/P"
SetListViewAction CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_COLUMN, "9","Commision"
SetListViewAction CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_COLUMN, "10","Interest"

SetListViewSettings CSTR(frmID), CSTR("MyList"),LIST_VIEW_FULL_ROW_SELECT,true
SetListViewSettings CSTR(frmID), CSTR("MyList"),LIST_VIEW_STYLE,3
SetListViewSettings CSTR(frmID), CSTR("MyList"),LIST_VIEW_MULTI_SELECT,true
SetListViewSettings CSTR(frmID), CSTR("MyList"),LIST_VIEW_FLAT_SCROLLBAR,true
SetListViewSettings CSTR(frmID), CSTR("MyList"),LIST_VIEW_SORTED,true
SetListViewSettings CSTR(frmID), CSTR("MyList"),LIST_VIEW_ALLOW_COLUMN_REORDER,true


for j = 1 to 10

SetListViewSettings CSTR(frmID), CSTR("MyList"),LIST_VIEW_COLUMN_WIDTH,1200,Cint(j)
next
Dim ticketNo
Dim result 
Dim ticketSympol
Dim time1 
Dim OpenPrice1
Dim type1
Dim typeStr
Dim SL
Dim TP
Dim Comm
Dim Interest

for i=1 to PositionTotal
ticketNo = PositionGetTicket(cint (i))
PositionSelect(Clng (ticketNo))
ticketNo = PositionGetTicket(cint (i))
time1 = GetPositionTime()
type1 = GetPositionType()
PositionGetDouble POSITION_SL,SL
PositionGetDouble POSITION_TP,TP
PositionGetDouble POSITION_COMMISSION,Comm
PositionGetDouble POSITION_SWAP,Interest

Select case type1
  case 1

typeStr = "buy"
  case -1

typeStr = "sell"
  case 2

typeStr = "buy stop"
  case -2

typeStr = "sell stop"

End SELECT

PositionGetDouble POSITION_AMOUNT ,result
ticketSympol = Cstr(PositionGetSymbol(Cint(i)))
PositionGetDouble POSITION_PRICE_OPEN ,OpenPrice1


SetListSubItem CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_SUBITEM, Cstr(i), Cstr(ticketNo),0
SetListSubItem CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_SUBITEM, Cstr(i), Cstr(time1),1
SetListSubItem CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_SUBITEM, Cstr(i), Cstr(typeStr),2
SetListSubItem CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_SUBITEM, Cstr(i), Cstr(result),3
SetListSubItem CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_SUBITEM, Cstr(i), Cstr(ticketSympol),4
SetListSubItem CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_SUBITEM, Cstr(i), Cstr(OpenPrice1),5
SetListSubItem CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_SUBITEM, Cstr(i), Cstr(SL),6
SetListSubItem CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_SUBITEM, Cstr(i), Cstr(TP),7
SetListSubItem CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_SUBITEM, Cstr(i), Cstr(Comm),8
SetListSubItem CSTR(frmID), CSTR("MyList"), LIST_VIEW_ACTION_ADD_SUBITEM, Cstr(i), Cstr(Interest),9
next


End Sub


Public Sub OnTick(symbolName)
End Sub

Public Sub OnInit()
End Sub

Public Sub OnDeInit()
End Sub

Public Sub OnTimer()
End Sub

Public Sub OnCalculate(symbol, symbolPeriod, openVal, highVal, lowVal, closeVal)
End Sub

Public Sub AllDataLoaded()
End Sub

Public Sub AccountSelected()
End Sub

Public Sub OnOrderTrade(actionType ,orderID , returnValue)
End Sub

Public Sub OnPositionTrade (actionType ,ticketID)
End Sub

 


See Also


Back to VTL Client Script Index

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Help Desk Software by Hybrid Solutions