Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 0.88 KB | None | 0 0
  1. public  class KlassA : Object {
  2.     public int a = 5;
  3. }
  4.  
  5. void main(){
  6.    
  7.     var paramspec = new ParamSpecInt("new_int_property",
  8.                                             "sas",
  9.                                             "sas",
  10.                                             0,//min
  11.                                             10,//max
  12.                                             0,//default
  13.                                             ParamFlags.READWRITE);
  14.     (typeof(KlassA).class_ref() as ObjectClass).install_property(0,paramspec); //Operation not supported for this type
  15.     var a = new KlassA();
  16.     a.set_property("new_int_property",5);
  17.     var prop = Value(a.get_class().find_property("new_int_property").owner_type);
  18.     a.get_property("new_int_property",ref prop);
  19.     prin(prop.get_int());
  20. }
  21.  
  22. [Print]
  23. inline void prin(string str){
  24.     stdout.printf(str + "\n");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement