Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Oct 18, 2017 5:20 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Is there a way to this programmically?
PostPosted: Sat Jun 01, 2013 4:21 pm 
Offline

Joined: Wed Sep 15, 2010 1:48 pm
Posts: 84
Simple program. Window1 a listbox and a button

press window1's button and get all the properties for ether the button (bevelbutton) or the listbox

window2 a property display like in the ide (listbox, 2 columns)

I am trying to make a very simple preferences system programmically. I might be doing this wrong, or I do not understand how to move objects around correctly.

In bevelbutton,action event you can not have something like:

window2.run(window1.listbox)

in window2.run you could use introspection to get the properties, and if you modify them, could window1.lisbox be sent byref ?

Am I missing something important?

_________________
RS2012r2 Pro Win


Top
 Profile  
Reply with quote  
 Post subject: Re: Is there a way to this programmically?
PostPosted: Sat Jun 01, 2013 11:11 pm 
Offline

Joined: Sat Oct 01, 2005 12:01 pm
Posts: 65
Location: above sea level
// put in Window1 bevelbuttons Action event

//this will get data in Window2 for Window1

Dim strCaption As String
strCaption = Window2.BevelButton1.Caption
MsgBox "BevelButton1 Caption = "+ strCaption

Dim intValue As Integer
intValue = Window2.Listbox1.ColumnCount
MsgBox "ColumnCount= "+ str(intValue)



// this will set data in Window2 from Window1

Dim datNow As new Date
Window2.BevelButton1.Caption = datNow.SQLDateTime



this should get you started


Top
 Profile  
Reply with quote  
 Post subject: Re: Is there a way to this programmically?
PostPosted: Sun Jun 02, 2013 7:18 am 
Offline

Joined: Wed Sep 15, 2010 1:48 pm
Posts: 84
That is not exactly what i want to do.

W_debug.show


listbox1.ColumnCount =2
listbox1.ColumnType(1) =3
For i As Integer = 0 To WindowCount - 1
Dim w As Window = Window(i)
If w <> Nil Then
//ListBox1.AddRow(w.Title)
//msgbox w.Window_Type // shows window type if w is window1 and not window
//msgbox str(w.Handle)


Dim o as Runtime.ObjectIterator=Runtime.IterateObjects
While o.MoveNext


Dim myProperties() as Introspection.PropertyInfo = Introspection.GetType(o.current).GetProperties


For i1 as Integer=0 to Ubound(myProperties)


if myProperties(i1).name = "Handle" then
if myProperties(i1).Value(o.current) = W.Handle then
W_debug.run("---------------------------------------------------------" + myProperties(i1).name)
// msgbox "MATCH FOUND"


W_debug.run("---------------------" + str(w.handle))
W_debug.run("---------------------" + w.Title)

For x as Integer=0 to Ubound(myProperties)
W_debug.run("---------------------" + myProperties(x).name + "-"_
+ myProperties(x).PropertyType.Fullname )
//W_debug.run("------" + myProperties(x).Value(o.current) ) //type mismatch exception
if myProperties(x).name = "Window_Type" then
dim z as string

z= myProperties(x).Value(o.current)


msgbox z

end if



dim s as string
select case myProperties(x).PropertyType.fullname

case is = "Int32"
s= str(myProperties(x).Value(o.current))


case is = "Int64"
s= str(myProperties(x).Value(o.current))

case is = "Currency"
s= str(myProperties(x).Value(o.current))


case is = "Boolean"
s= (myProperties(x).Value(o.current))


case is = "String"
s= (myProperties(x).Value(o.current))


case is = "String()"
s= "string List"


case is = "Double"
s= str(myProperties(x).Value(o.current))


case is = "Object"
s= "Object"


case is = "Object()"
s= "Object() "

end select

W_debug.run("------" + s )
listbox1.addrow
listbox1.cell(listbox1.LastIndex,0) = myProperties(x).name
listbox1.cell(listbox1.LastIndex,1) = s
listbox1.RowTag(listbox1.LastIndex) = myProperties(x).Value(o.current)
next x

exit for
exit While
end if
end if
Next




Wend

End If
Next


I think I figured this out, but still need to improve code. I loop through all windows, find window.handle, use introspection to get the properties of the window, including custom properties. Still trying to figure this out.

I get a listbox with property values, but what is the best way to modify them?

How do I handle the objects?

_________________
RS2012r2 Pro Win


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group