[Gambas-user] Object.Class with forms

Dani Santos jose.santos at ...429...
Wed Nov 2 14:11:07 CET 2005


Hi again!

I've got to test wether a control is or not a form.

I've made it work perfectly with TextBoxes, Labels, etc. with code like
this:

  SELECT CASE Object.Class(pControl)

  CASE "Label"
    labelTmp = pControl
    labelTmp.BackColor = COLOR_TITULOS
    labelTmp.ForeColor = COLOR_TEXTOTITULOS
  CASE "Button"
    buttonTmp = pControl
	(...)

But If I try to do it with forms, i.e. something like:

  ' Getting the parent form and attaching to the object for resizing
  ' purposes.
  m_intParentWidth = m_table.Parent.Width
  parentForm = m_table.Parent
  DO WHILE parentForm <> NULL

    IF Object.Class(parentForm) = "Form" THEN
      Object.Attach(parentForm, ME, "ParentForm")
      BREAK
    ELSE
      parentForm = parentForm.Parent
    ENDIF
  LOOP

ObjectClass does not return "Form" for a Form object but "FrmMain",
"FrmSelectTheme", etc. i.e., the name of the form.

¿Any idea about how knowing if a given control is a Form?

Thanks. 

-- 
Dani Santos <jose.santos at ...429...>





More information about the User mailing list