New way to set the default item selected in a popupbutton.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@19033 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-04-06 04:23:40 +00:00
parent a6543f73c0
commit 03adac38a7
4 changed files with 22 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2004-04-06 00:16 Gregory John Casamento <greg_casamento@yahoo.com>
* Palettes/2Controls/inspectors.m: added defaultItemForm attribute.
Added code in [GormPopUpButtonAttributesInspector
_setValuesFromControl:] to select the appropriate item, when the
value is changed in the inspector.
* Palettes/2Controls/GormNSPopUpButtonInspector.gorm:
corresponding changes to above code modifications.
2004-04-05 00:06 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: [GormDocument rebuildObjToNameMapping] some

View file

@ -147,7 +147,8 @@
Outlets = (
disabledSwitch,
tagForm,
typeMatrix
typeMatrix,
defaultItemForm
);
Super = IBInspector;
};

View file

@ -862,6 +862,7 @@
id typeMatrix;
id disabledSwitch;
id tagForm;
id defaultItemForm;
}
@end
@ -885,6 +886,15 @@
{
[object setTag: [[control cellAtIndex: 0] intValue]];
}
else if (control == defaultItemForm)
{
int index = [[control cellAtIndex: 0] intValue];
int num = [object numberOfItems];
// if the user enters more than the number, select the last item.
index = (index < num && index >= 0) ? index : num;
[object selectItemAtIndex: index];
}
}
- (void) _getValuesFromObject: (id)anObject
@ -896,6 +906,7 @@
[typeMatrix selectCellWithTag: [anObject pullsDown]];
[disabledSwitch setState: ![anObject autoenablesItems]];
[[tagForm cellAtRow: 0 column: 0] setIntValue: [anObject tag]];
[[defaultItemForm cellAtRow: 0 column: 0] setIntValue: [anObject indexOfSelectedItem]];
}
- (id) init