Print Page | Close Window

SOLVED:how to read or write from property grid

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=11957
Printed Date: 27 November 2024 at 10:57am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SOLVED:how to read or write from property grid
Posted By: Marino
Subject: SOLVED:how to read or write from property grid
Date Posted: 25 August 2008 at 6:15am
Hi,

I use clarion to work with codejock so if somebody can give some advise ... how to read from or write into propery grid ... this is a code which I use for setting and initialising property grid ...


LOC:OCXproperty     = CSTRING(20)
Loc:Property1       = CSTRING(20)
Loc:Property1item   = CSTRING(20)
Loc:Prop1           = CSTRING(20)

  code
?property{prop:create} = 'Codejock.PropertyGrid.12.0.1'
Loc:OCXproperty = CREATE(?property,CREATE:OLE)

Loc:Property1 = ?property{'InsertCategory(0,"category 1")'}
Loc:Property1item = ?property{Loc:Property1 & '.AddChildItem(0,"option 1-1","something 1")'}
Loc:prop1 = ?property{Loc:Property1item & '.insertChildItem(1,0,"suboption 1", "sub-something 1")'}
Loc:Property1item = ?property{Loc:Property1 & '.AddChildItem(0,"option 2-1","something 2")'}
Loc:Property1item = ?property{Loc:Property1 & '.AddChildItem(0,"option 3-1","something 3")'}
Loc:Property1item = ?property{Loc:Property1 & '.AddChildItem(0,"option 4-1","something 4")'}
Loc:Property1 = ?property{'InsertCategory(1,"category 2")'}
Loc:Property1item = ?property{Loc:Property1 & '.AddChildItem(0,"option 1-2",9)'}
Loc:Property1item = ?property{Loc:Property1 & '.AddChildItem(0,"option 2-2",9)'}
Loc:Property1item = ?property{Loc:Property1 & '.AddChildItem(0,"option 3-2",9)'}

now, how to read and write values  ... I tried with .AddChildItemBinded too, but don't know how to put the name of the object like a parameter ... Tried with .Value, but didn't work, maybe my mistake...






Replies:
Posted By: Aaron
Date Posted: 25 August 2008 at 10:16am
Hi,
 
I'm not familiar with Clarion but you know that already
 
But I will try:
 
This will be in VB code.
 
Add item to category:
 
Set Item = selectionCategory.AddChildItem(PropertyItemString, "option 1-1", False)
      Item.Id = ID_PROPGRID_INCLUDEITEMS
 
Where:
selectionCategory                      = CategoryItem where item is added
Item                                           = PropertyGridItem
ID_PROPGRID_INCLUDEITEMS   = ID of added item
 
To find item use method FindItem:
 
Set Item = wndPropertyGrid.FindItem("option 1-1")
or by ID Set Item = wndPropertyGrid.FindItem(ID_PROPGRID_INCLUDEITEMS)
 
 
Where:
wndPropertyGrid = PropertyGrid control
Item                     = PropertyGridItem
FindItem             = method to find item in collection with ID or Caption
 
To read value:
 
msgbox Item.Value
(or messagebox or whatever Clarion uses to display a message)
 
to write value
Item.Value = "option 1a-1a"
 
I don't know if Clarion will accept this but you can also use it like this:
 
read:
msgbox wndPropertyGrid.FindItem("option 1-1").Value
msgbox wndPropertyGrid.FindItem(ID_PROPGRID_INCLUDEITEMS).Value
 
write:
wndPropertyGrid.FindItem("option 1-1").Value = "option 1a-1a"
wndPropertyGrid.FindItem(ID_PROPGRID_INCLUDEITEMS).Value = "option 1a-1a"
 
 
 
Hope this helps you a little  Just ask me if things aren't clear.
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: Marino
Date Posted: 27 August 2008 at 9:18am
Hi Aaron,

well, I did it :-) ... thanks to you ... I renamed my variables to make easier for read and use the following code:

Loc:OCXproperty = STRING(20)
Loc:category        =STRING(20)
Loc:item               =STRING(20)
var1                     =STRING('templates for codejock controls')
var2                     =STRING(50)
var3                     =STRING(50)

code
?wndPropertyGrid{prop:create} = 'Codejock.PropertyGrid.12.0.1'
Loc:OCXproperty = CREATE(?wndPropertyGrid,CREATE:OLE)

Loc:category =  ?wndPropertyGrid{'AddCategory("some documents")'}
Loc:item =      ?wndPropertyGrid{Loc:category & '.AddChildItem(0,"books","programming in clarion")'}
                ?wndPropertyGrid{Loc:item & '.id'} = 1

Loc:item =      ?wndPropertyGrid{Loc:category & '.AddChildItem(0,"magazines","clarionmag.com")'}
                ?wndPropertyGrid{Loc:item & '.id'} = 2

Loc:item =      ?wndPropertyGrid{Loc:category & '.AddChildItem(0,"flyers","noyantis.com")'}
                ?wndPropertyGrid{Loc:item & '.id'} = 3
                ?wndPropertyGrid{Loc:item & '.value'} = var1
var2 =            ?wndPropertyGrid{'finditem(3).value'}
var3 =            ?wndPropertyGrid{'finditem("magazines").value'}

Thanks to Andy Wilton and his great job of writing the templates for using this great controls with clarion, the community of clarion users of codejock controls is everyday bigger and bigger, but while we wait for the rest of templates, I'm sure that many of us will try to play with this ...

Once again, thank you Aaron on your help,

Regards,

Marino


Posted By: Aaron
Date Posted: 27 August 2008 at 9:48am
Hi,
 
If your isssue has been solved, please change your topic description into SOLVED: how to read or write from property grid and have a look at post:
https://forum.codejock.com/forum_posts.asp?TID=11225 - https://forum.codejock.com/forum_posts.asp?TID=11225
 
This would be much easier for all members just to see what kind of language you use. If you would do the same we would all be happy
 
And if you have any sample code (you mentioned somekind of template) to share with other Clarion users, you could upload one in the sample subforum.
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net