Class: WIN32OLE_VARIABLE

Inherits:
Object
  • Object
show all
Defined in:
win32ole.c,
win32ole.c

Overview

WIN32OLE_VARIABLE objects represent OLE variable information.

Instance Method Summary collapse

Instance Method Details

#inspect ⇒ String

Returns the OLE variable name and the value with class name.

Returns:

  • (String)


6538
6539
6540
6541
6542
6543
6544
6545
# File 'win32ole.c', line 6538

static VALUE
folevariable_inspect(VALUE self)
{
    VALUE detail = rb_funcall(self, rb_intern("to_s"), 0);
    rb_str_cat2(detail, "=");
    rb_str_concat(detail, rb_funcall(rb_funcall(self, rb_intern("value"), 0), rb_intern("inspect"), 0));
    return make_inspect("WIN32OLE_VARIABLE", detail);
}

#name ⇒ Object Also known as: to_s

Returns the name of variable.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
 puts "#{variable.name}"
end

The result of above script is following:
 xlChart
 xlDialogSheet
 xlExcel4IntlMacroSheet
 xlExcel4MacroSheet
 xlWorksheet


6263
6264
6265
6266
6267
# File 'win32ole.c', line 6263

static VALUE
folevariable_name(VALUE self)
{
    return rb_ivar_get(self, rb_intern("name"));
}

#ole_type ⇒ Object

Returns OLE type string.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
puts "#{variable.ole_type} #{variable.name}"
end

The result of above script is following:
INT xlChart
INT xlDialogSheet
INT xlExcel4IntlMacroSheet
INT xlExcel4MacroSheet
INT xlWorksheet


6303
6304
6305
6306
6307
6308
6309
# File 'win32ole.c', line 6303

static VALUE
folevariable_ole_type(VALUE self)
{
    struct olevariabledata *pvar;
    Data_Get_Struct(self, struct olevariabledata, pvar);
    return ole_variable_ole_type(pvar->pTypeInfo, pvar->index);
}

#ole_type_detail ⇒ Object

Returns detail information of type. The information is array of type.

tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', 'D3DCLIPSTATUS')
variable = tobj.variables.find {|variable| variable.name == 'lFlags'}
tdetail  = variable.ole_type_detail
p tdetail # => ["USERDEFINED", "CONST_D3DCLIPSTATUSFLAGS"]


6337
6338
6339
6340
6341
6342
6343
# File 'win32ole.c', line 6337

static VALUE
folevariable_ole_type_detail(VALUE self)
{
    struct olevariabledata *pvar;
    Data_Get_Struct(self, struct olevariabledata, pvar);
    return ole_variable_ole_type_detail(pvar->pTypeInfo, pvar->index);
}

#value ⇒ Object

Returns value if value is exists. If the value does not exist, this method returns nil.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
 puts "#{variable.name} #{variable.value}"
end

The result of above script is following:
 xlChart = -4109
 xlDialogSheet = -4116
 xlExcel4IntlMacroSheet = 4
 xlExcel4MacroSheet = 3
 xlWorksheet = -4167


6381
6382
6383
6384
6385
6386
6387
# File 'win32ole.c', line 6381

static VALUE
folevariable_value(VALUE self)
{
    struct olevariabledata *pvar;
    Data_Get_Struct(self, struct olevariabledata, pvar);
    return ole_variable_value(pvar->pTypeInfo, pvar->index);
}

#variable_kind ⇒ Object

Returns variable kind string.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
 puts "#{variable.name} #{variable.variable_kind}"
end

The result of above script is following:
 xlChart CONSTANT
 xlDialogSheet CONSTANT
 xlExcel4IntlMacroSheet CONSTANT
 xlExcel4MacroSheet CONSTANT
 xlWorksheet CONSTANT


6483
6484
6485
6486
6487
6488
6489
# File 'win32ole.c', line 6483

static VALUE
folevariable_variable_kind(VALUE self)
{
    struct olevariabledata *pvar;
    Data_Get_Struct(self, struct olevariabledata, pvar);
    return ole_variable_kind(pvar->pTypeInfo, pvar->index);
}

#varkind ⇒ Object

Returns the number which represents variable kind. tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#WIN32OLE_VARIABLE.variablevariable.name #WIN32OLE_VARIABLE.variablevariable.varkind" end

The result of above script is following:
 xlChart 2
 xlDialogSheet 2
 xlExcel4IntlMacroSheet 2
 xlExcel4MacroSheet 2
 xlWorksheet 2


6523
6524
6525
6526
6527
6528
6529
# File 'win32ole.c', line 6523

static VALUE
folevariable_varkind(VALUE self)
{
    struct olevariabledata *pvar;
    Data_Get_Struct(self, struct olevariabledata, pvar);
    return ole_variable_varkind(pvar->pTypeInfo, pvar->index);
}

#visible? ⇒ Boolean

Returns true if the variable is public.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
 puts "#{variable.name} #{variable.visible?}"
end

The result of above script is following:
 xlChart true
 xlDialogSheet true
 xlExcel4IntlMacroSheet true
 xlExcel4MacroSheet true
 xlWorksheet true

Returns:

  • (Boolean)


6427
6428
6429
6430
6431
6432
6433
# File 'win32ole.c', line 6427

static VALUE
folevariable_visible(VALUE self)
{
    struct olevariabledata *pvar;
    Data_Get_Struct(self, struct olevariabledata, pvar);
    return ole_variable_visible(pvar->pTypeInfo, pvar->index);
}