Real Software Forums
http://forums.realsoftware.com/

Is there a way to this programmically?
http://forums.realsoftware.com/viewtopic.php?f=10&t=48037
Page 1 of 1

Author:  Dave_ [ Sat Jun 01, 2013 4:21 pm ]
Post subject:  Is there a way to this programmically?

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?

Author:  HiddenPaw [ Sat Jun 01, 2013 11:11 pm ]
Post subject:  Re: Is there a way to this programmically?

// 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

Author:  Dave_ [ Sun Jun 02, 2013 7:18 am ]
Post subject:  Re: Is there a way to this programmically?

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?

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/