+void wxControl::SetFieldLabel(const wxString& label)
+{
+ FieldType* field = (FieldType*)GetObjectPtr();
+ if(field==NULL)
+ return;
+
+ uint16_t newSize = label.length() + 1;
+ MemHandle strHandle = FldGetTextHandle(field);
+ FldSetTextHandle(field, NULL );
+ if (strHandle)
+ {
+ if(MemHandleResize(strHandle, newSize)!=errNone)
+ strHandle = 0;
+ }
+ else
+ {
+ strHandle = MemHandleNew( newSize );
+ }
+ if(!strHandle)
+ return;
+
+ char* str = (char*) MemHandleLock( strHandle );
+ if(str==NULL)
+ return;
+
+ strcpy(str, label.c_str());
+ MemHandleUnlock(strHandle);
+ FldSetTextHandle(field, strHandle);
+ FldRecalculateField(field, true);
+}
+
+void wxControl::SetControlLabel(const wxString& label)
+{
+ ControlType* control = (ControlType*)GetObjectPtr();
+ if(control==NULL)
+ return;
+ CtlSetLabel(control, "");
+ m_label = label;
+ if(!m_label.empty())
+ CtlSetLabel(control,m_label.c_str());
+}
+
+void wxControl::SetLabel(const wxString& label)
+{
+ if(IsPalmField())
+ SetFieldLabel(label);
+
+ // unlike other native controls, slider has no label
+ if(IsPalmControl() && !wxDynamicCast(this,wxSlider))
+ SetControlLabel(label);
+}
+
+wxString wxControl::GetFieldLabel()
+{
+ FieldType* field = (FieldType*)GetObjectPtr();
+ if(field==NULL)
+ return wxEmptyString;
+ return FldGetTextPtr(field);
+}
+
+wxString wxControl::GetControlLabel()
+{
+ ControlType* control = (ControlType*)GetObjectPtr();
+ if(control==NULL)
+ return wxEmptyString;
+ return CtlGetLabel(control);
+}
+#if 0
+wxString wxControl::GetLabel()
+{
+ if(IsPalmField())
+ return GetFieldLabel();
+
+ // unlike other native controls, slider has no label
+ if(IsPalmControl() && !wxDynamicCast(this,wxSlider))
+ return GetControlLabel();
+
+ return wxEmptyString;
+}
+#endif