void HDialog::SetOn(const char *name, bool on) { BControl *ctrl; ctrl = dynamic_cast<BControl *>(FindView(name)); if (ctrl) ctrl->SetValue(on ? B_CONTROL_ON : B_CONTROL_OFF); } /* HDialog::SetOn */
status_t PControl::SetProperty(const char *name, PValue *value, const int32 &index) { // Modal, Front, and Floating properties are missing because they are read-only if (!name || !value) return B_ERROR; BString str(name); PProperty *prop = FindProperty(name,index); if (!prop) return B_NAME_NOT_FOUND; status_t status = prop->SetValue(value); if (status != B_OK) return status; if (!fView) return B_NO_INIT; BControl *viewAsControl = (BControl*)fView; BoolValue bv; IntValue iv; StringValue sv; if (viewAsControl->Window()) viewAsControl->Window()->Lock(); if (str.ICompare("Enabled") == 0) { prop->GetValue(&bv); viewAsControl->SetEnabled(bv.value); } else if (str.ICompare("Label") == 0) { prop->GetValue(&sv); viewAsControl->SetLabel(sv.value->String()); viewAsControl->Invalidate(); } else if (str.ICompare("Value") == 0) { prop->GetValue(&iv); viewAsControl->SetValue(*iv.value); } else { if (viewAsControl->Window()) viewAsControl->Window()->Unlock(); return PView::SetProperty(name,value,index); } if (viewAsControl->Window()) viewAsControl->Window()->Unlock(); return prop->GetValue(value); }