Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Oct 19, 2017 2:31 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Einhugur StlyeGrid question
PostPosted: Wed Apr 17, 2013 4:30 pm 
Offline

Joined: Sat Dec 04, 2010 9:14 pm
Posts: 918
Hello all,

Can anyone tell me how to *add* rows to a stylegrid that already has data?
This is the existing code, which works fine to add records all at once. But to add more, the existing are deleted.
The line that appears to control the deletion is "grdAlarmActivity.Rows = 0". However, if this is remarked out, no lines are ever display.

Ideas would be greatly appreciated!
Thank you,
Tim

Dim i as Integer
Dim pCell as StyleGridCell
Dim pRow as StyleGridRow
Dim pStyle as StyleGridStyle
grdAlarmActivity.Rows = 0

grdAlarmActivity.Cols = 5
Dim W As Integer =grdAlarmActivity.Width
grdAlarmActivity.Column(1).Width = 65
grdAlarmActivity.Column(2).Width = 50
grdAlarmActivity.Column(3).Width =125 //Date/Time
grdAlarmActivity.Column(4).Width = 150 //Tenant Name

For i = 1 to 4
w = w -grdAlarmActivity.Column(i).Width
Next i
grdAlarmActivity.Column(5).Width = w

grdAlarmActivity.Column(1).Header.Text = "Unit"
grdAlarmActivity.Column(2).Header.Text = "Door"
grdAlarmActivity.Column(3).Header.Text = "Date/Time"
grdAlarmActivity.Column(4).Header.Text = "Tenant"
grdAlarmActivity.Column(5).Header.Text = "Alarm?"

grdAlarmActivity.Column(1).Alignment = 0

If App.eDatabaseOpen = False Then Return
grdAlarmActivity.LockDrawing = true

Dim d As New Date

Dim Parse As New modinet.clsParse
//Dim Result As Integer = 0
Call Parse.Parse(Data,"+",10)
'Check to see if Alarm is Assigned
' 100 'Dr Closed No Alarm
' 101 'Dr Open No Alarm
' 102 'Dr Closed Alarm
' 103 'Dr Opened Alarm
'104 'Mux Tamper

' 110 'Dr Closed No Alarm/Not Enabled
' 111 'Dr Open No Alarm/Not Enabled



If Val(Parse.ReturnArray(2)) <> 100 or Val(Parse.ReturnArray(2)) <> 101 Then
'0 100:100
'1 0
'2 110 //Event Code
'3 date/time
'4 message
'5 Alarm not warranted
'6 unit
'7 dr state
'8 Fname
'9 Lname

pRow = new StyleGridRow(grdAlarmActivity)
pCell = pRow.WritableCell(1)
pCell.Text =Parse.ReturnArray(6)
pCell.Style = pStyle
pCell.LeftIndent = 25 // Make Space for the picture

If Parse.ReturnArray(7) = "O" Then pRow.WritableCell(2).Text ="Open" //"Doors state"
If Parse.ReturnArray(7) = "C" Then pRow.WritableCell(2).Text ="Closed" //"Doors state"
pRow.WritableCell(3).Text = Parse.ReturnArray(3)

Dim LN as String = Mid(Parse.ReturnArray(9),1,Len(Parse.ReturnArray(9))-1)
pRow.WritableCell(4).Text = Parse.ReturnArray(8) + " " + Ln
pRow.WritableCell(5).Text = Parse.ReturnArray(5)

grdAlarmActivity.AppendRow(pRow)
End If

//grdAlarmActivity.Column(1).Alignment = 0
For i = 1 to 5
grdAlarmActivity.Column(i).Alignment = 0
Next i
grdAlarmActivity.LockDrawing = false


Top
 Profile  
Reply with quote  
 Post subject: Re: Einhugur StlyeGrid question
PostPosted: Wed Apr 17, 2013 5:36 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
The StyleGrid.Row function brings back the StyleGridRow. Then you can reference the individual cells in the StyleGridRow. I believe you can dereference it like this (been a while):

grdAlarmActivity.row(OnebasedRow).Cell(OneBasedColumn).Text = "Some Text"

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group