New topic: 

Is there a way to this programmically?

<http://forums.realsoftware.com/viewtopic.php?t=48037>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        Dave_          Post subject: Is there a way to this 
programmically?Posted: Sat Jun 01, 2013 4:21 pm                         
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                HiddenPaw          Post 
subject: Re: Is there a way to this programmically?Posted: Sat Jun 01, 2013 
11:11 pm                         
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                Dave_          Post subject: 
Re: Is there a way to this programmically?Posted: Sun Jun 02, 2013 7:18 am      
                   
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             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to