Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Engine.UIComboBox


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
#linenumber 1

/**
 * A complex widget which contains a list, a button for toggling the visibility of the list, and an editbox for displaying
 * the currently selected item when the list is not visible.  Also supports rendering a caption to left, right, above, or below
 * the editbox.
 *
 * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved
 */

//`define requires_unique_list_datasource 1

class UIComboBox extends UIObject
	native(UIPrivate)
	placeable
	implements(UIDataStorePublisher);
























































































































 



#linenumber 18

/*
	Kismet events needed:
		- [N/A] selected item changed (wouldn't be necessary if sequence events were propagated up the parent chain)
		- [N/A] user typed into the editbox (handled by editbox?) (wouldn't be necessary if sequence events were propagated up the parent chain)
			- event propagation is now enabled....make compatible.

	General todo:
		- implement the CaptionRenderComponent.
		- Also, if we have a CaptionRenderComponent, need to adjust the region available for rendering the editbox/button so that we have room to render the caption.
		- refactor UIComp_DrawString to not assume that the entire bounds of the owning widget should be considered the "adjustable region" when the component is configured
			to autosize itself.

		- should we add a data store binding property for the combo's background image component?

		- [N/A (as long as we don't support instant update of the editbox text)] if the list loses focus, restore the editbox's text to the previous item
*/
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)

/**
 * The class to use for creating the combo box's editbox.  If more control of the creation is necessary, or to use an existing
 * editbox, subscribe to the CreateCustomComboEditbox delegate instead.
 */
var		const	class<UIEditBox>								ComboEditboxClass;

/**
 * The class to use for creating the combo box's button.  If more control of the creation is necessary, or to use an existing
 * button, subscribe to the CreateCustomComboButton delegate instead.
 */
var		const	class<UIToggleButton>							ComboButtonClass;

/**
 * The class to use for creating the combo box's list.  If more control of the creation is necessary, or to use an existing
 * list, subscribe to the CreateCustomComboList delegate instead.
 */
var		const	class<UIList>									ComboListClass;

/**
 * Used to display the currently selected value
 * @todo - need script accessors for safely replacing the editbox with a new type, since the var is const
 */
var()	editinline	const	noclear		UIEditBox				ComboEditbox;

/**
 * Used to toggle the visibility of the list
 * @todo - need script accessors for safely replacing the button with a new type, since the var is const
 */
var()	editinline	const	noclear		UIToggleButton			ComboButton;

/**
 * Contains the collection of available choices for this combo box
 * @todo - need script accessors for safely replacing the list with a new type, since the var is const
 */
var()	editinline	const	noclear		UIList					ComboList;


//@todo - specify where the caption should render; left/right/top/bottom
/**
 * Optional component for rendering a caption next to the editbox.  No value given by default.
 */
var(Presentation)	editinline	const 	UIComp_DrawCaption		CaptionRenderComponent;

/**
 * Optional component for rendering a background image for this combo box.  No value given by default.
 */
var(Presentation)	editinline	const	UIComp_DrawImage		BackgroundRenderComponent;

/**
 * The data source this this combo box's caption will link to, if applicable.
 */
var(Data)	editconst	const	private		UIDataStoreBinding	CaptionDataSource;

/* = Sounds = */
/**
 * This sound is played when the list is made visible.  It will be played at the same time as the combobox button's clicked sound, so it's recommended to
 * clear any sound cues assign to the combo box button's ClickedCue.
 */
var(Sound)									name				OpenList;

/**
 * This sound is played when the combo's list is hidden  It will be played at the same time as the combobox button's clicked sound, so it's recommended to
 * clear any sound cues assign to the combo box button's ClickedCue.
 */
var(Sound)									name				DecrementCue;


/* = Constraints & Parameters = */
/**
 * Indicates whether the list's selected item can be modified.  The editbox has its own property for controlling whether the user is allowed to type into the editbox.
 */
var()										bool				bLockSelectedItem;

/**
 * Controls whether the list is docked to the combobox itself or the inside face of the button.
 */
var(Presentation)	private					bool				bDockListToButton<Tooltip=If enabled, the list will be the same width as the editbox.  If disabled, the list will be the same width as the entire combobox (default behavior).>;

const TEXT_CHANGED_NOTIFY_MASK=0x1;
const INDEX_CHANGED_NOTIFY_MASK=0x2;

/* == Delegates == */

/**
 * Provides a convenient way to override the creation of the combo's components.  Called when this UIComboBox is first initialized.
 *
 * @return	if a custom component is desired, a pointer to a fully configured instance of the desired component class.  You must use
 *			UIScreenObject.CreateWidget to create the widget instances.  The returned instance will be inserted into the combo box's
 *			Children array and initialized.
 */
delegate UIEditBox		CreateCustomComboEditbox( UIComboBox EditboxOwner );
delegate UIToggleButton	CreateCustomComboButton( UIComboBox ButtonOwner );
delegate UIList			CreateCustomComboList( UIComboBox ListOwner );

//@todo - add OnVisibilityChanged delegate to UIScreenObject, to allow hooking into the showing/hiding of the list

/* == Events == */

/* == Natives == */

/**
 * Sets the data store binding for this object to the text specified.
 *
 * @param	MarkupText			a markup string which resolves to data exposed by a data store.  The expected format is:
 *								<DataStoreTag:DataFieldTag>
 * @param	BindingIndex		indicates which data store binding should be modified.  Valid values and their meanings are:
 *									0:	list data source
 *									1:	caption data source
 */
native final virtual function SetDataStoreBinding( string MarkupText, optional int BindingIndex=INDEX_NONE );

/**
 * Retrieves the markup string corresponding to the data store that this object is bound to.
 *
 * @param	BindingIndex		indicates which data store binding should be modified.  Valid values and their meanings are:
 *									0:	list data source
 *									1:	caption data source
 *
 * @return	a datastore markup string which resolves to the datastore field that this object is bound to, in the format:
 *			<DataStoreTag:DataFieldTag>
 */
native final virtual function string GetDataStoreBinding( optional int BindingIndex=INDEX_NONE ) const;

/**
 * Resolves this subscriber's data store binding and updates the subscriber with the current value from the data store.
 *
 * @param	BindingIndex		indicates which data store binding should be modified.  Valid values and their meanings are:
 *									-1:	all data sources
 *									0:	list data source
 *									1:	caption data source
 *
 * @return	TRUE if this subscriber successfully resolved and applied the updated value.
 */
native final virtual function bool RefreshSubscriberValue( optional int BindingIndex=INDEX_NONE );

/**
 * Handler for the UIDataStore.OnDataStoreValueUpdated delegate.  Used by data stores to indicate that some data provided by the data
 * has changed.  Subscribers should use this function to refresh any data store values being displayed with the updated value.
 * notify subscribers when they should refresh their values from this data store.
 *
 * @param	SourceDataStore		the data store that generated the refresh notification; useful for subscribers with multiple data store
 *								bindings, to tell which data store sent the notification.
 * @param	PropertyTag			the tag associated with the data field that was updated; Subscribers can use this tag to determine whether
 *								there is any need to refresh their data values.
 * @param	SourceProvider		for data stores which contain nested providers, the provider that contains the data which changed.
 * @param	ArrayIndex			for collection fields, indicates which element was changed.  value of INDEX_NONE indicates not an array
 *								or that the entire array was updated.
 */
native final virtual function NotifyDataStoreValueUpdated( UIDataStore SourceDataStore, bool bValuesInvalidated, name PropertyTag, UIDataProvider SourceProvider, int ArrayIndex );

/**
 * Retrieves the list of data stores bound by this subscriber.
 *
 * @param	out_BoundDataStores		receives the array of data stores that subscriber is bound to.
 */
native function GetBoundDataStores( out array<UIDataStore> out_BoundDataStores );

/**
 * Notifies this subscriber to unbind itself from all bound data stores
 */
native function ClearBoundDataStores();

/**
 * Resolves this subscriber's data store binding and publishes this subscriber's value to the appropriate data store.
 *
 * @param	out_BoundDataStores	contains the array of data stores that widgets have saved values to.  Each widget that
 *								implements this method should add its resolved data store to this array after data values have been
 *								published.  Once SaveSubscriberValue has been called on all widgets in a scene, OnCommit will be called
 *								on all data stores in this array.
 * @param	BindingIndex		indicates which data store binding should be modified.  Valid values and their meanings are:
 *									-1:	all data sources
 *									0:	list data source
 *									1:	caption data source
 *
 * @return	TRUE if the value was successfully published to the data store.
 */
native function bool SaveSubscriberValue( out array<UIDataStore> out_BoundDataStores, optional int BindingIndex=INDEX_NONE );

/* == Unrealscript == */
/**
 * Propagate the enabled state of this widget.
 */
event PostInitialize()
{
	Super.PostInitialize();

	if ( ComboButton != None )
	{
		ComboButton.OnPressed = ButtonPressed;
		ComboButton.OnClicked = None;
	}

	if ( ComboList != None )
	{
		// Assign this delegate to have the editbox's text update instantly when the user mouses over an item in the list
		ComboList.OnValueChanged = SelectedItemChanged;
		ComboList.OnSubmitSelection = ListItemSelected;
	}

	if ( ComboEditbox != None )
	{
		ComboEditbox.OnValueChanged = EditboxTextChanged;
		ComboEditbox.OnPressed = EditboxPressed;

		if ( ComboEditbox.IsReadOnly() )
		{
			ComboEditbox.OnClicked = None;
		}
	}

	// when this widget is enabled/disabled, its children should be as well.
	ConditionalPropagateEnabledState(GetBestPlayerIndex());
}

/**
 * Changes whether this widget is visible or not.  Should be overridden in child classes to perform additional logic or
 * abort the visibility change.
 *
 * @param	bIsVisible	TRUE if the widget should be visible; false if not.
 */
event SetVisibility( bool bIsVisible )
{
	Super.SetVisibility(bIsVisible);

	HideList();
}

event ShowList( optional int PlayerIndex=GetBestPlayerIndex() )
{
//	`log(">>>>>" @ `location);
	if ( ComboList != None )
	{
		// toggle the list's visibility
		ComboList.SetVisibility(true);

		// change the graphic of the toggle button to the list open graphic
		ComboButton.SetValue(true, PlayerIndex);

		// give the list focus if it's visible
		ComboList.SetFocus(None, PlayerIndex);
		ComboList.SetTopIndex(ComboList.Index);
	}
//	`log("<<<<<" @ `location);
}

event HideList( optional int PlayerIndex=GetBestPlayerIndex() )
{
//	`log(">>>>>" @ `location);
	if ( ComboList != None )
	{
		// change the graphic of the toggle button to the normal graphic
		ComboButton.SetValue(false, PlayerIndex);

		// hide the list
		ComboList.SetVisibility(false);

		// reset the list's index to the item corresponding to the value in the editbox.
		//ComboList.SilentSetIndex( ComboList.FindIndex(TextStr) );
	}
//	`log("<<<<<" @ `location);
}

/**
 * Changes the editbox's text to the string specified.
 *
 * @param	NewText				the text to apply to the editbox
 * @param	PlayerIndex			Player that performed the action that issued the event.
 * @param	bListItemsOnly		if TRUE, will only apply the specified text if matches an existing element in the list
 * @param	bSkipNotification	specify TRUE to prevent the OnValueChanged delegate from being called.
 */
function SetEditboxText( string NewText, int PlayerIndex, optional bool bListItemsOnly, optional bool bSkipNotification )
{
//	`log(">>>" @ `location@`showvar(NewText));
	if ( ComboEditbox != None )
	{
		if ( (bListItemsOnly || ComboEditbox.IsReadOnly()) && ComboList != None )
		{
			// if the string isn't one the list's elements, bail
			/*
			if ( !ComboList.ContainsItem(NewText) )
			{
				return;
			}
			*/
		}
		ComboEditbox.SetValue(NewText, PlayerIndex, bSkipNotification);
	}
//	`log("<<<" @ `location@`showvar(NewText));
}

/**
 * Retrieves the value of bDockListToButton.
 */
final function bool IsListDockedToButton()
{
	return bDockListToButton;
}

/**
 * Changes the value of bDockListToButton to the specified value.
 */
function SetListDocking( bool bDockToButton )
{
	if ( bDockListToButton != bDockToButton )
	{
		bDockListToButton = bDockToButton;
		if ( ComboList != None )
		{
			if ( bDockListToButton && ComboButton != None )
			{
				ComboList.SetDockTarget(UIFACE_Right, ComboButton, UIFACE_Left);
			}
			else
			{
				ComboList.SetDockTarget(UIFACE_Right, Self, UIFACE_Right);
			}
			ComboList.RequestFormattingUpdate();
		}
	}
}

/* == Delegate Handlers == */
/**
 * Handler for the editbox's OnPress delegate.
 *
 * @param EventObject	Object that issued the event.
 * @param PlayerIndex	Player that performed the action that issued the event.
 */
function EditboxPressed( UIScreenObject EventObject, int PlayerIndex )
{
//	`log(`location@`showobj(EventObject));
	if ( ComboList != None && ComboList.IsHidden() && ComboEditbox.IsReadOnly() )
	{
		ComboEditbox.OnClicked = ShowListClickHandler;
	}
}

/**
 * Handler for the button's OnPressed delegate
 *
 * @param EventObject	Object that issued the event.
 * @param PlayerIndex	Player that performed the action that issued the event.
 */
function ButtonPressed( UIScreenObject EventObject, int PlayerIndex )
{
//	`log(" >>>>" @ `location@`showobj(EventObject)@`showvar(ComboList.IsVisible(),ComboListVisible));

	if ( ComboList != None && ComboList.IsHidden() )
	{
		// we can't call ShowList() from here because immediate after the OnPressed delegate call returns, the button will
		// take focus which would cause the list to be hidden.  Instead, we set the OnClicked delegate so that when the user releases
		// the mouse button, the list will be shown and take focus.
		ComboButton.OnClicked = ShowListClickHandler;
	}

//	`log(" <<<<" @ `location@`showobj(EventObject)@`showvar(ComboList.IsVisible(),ComboListVisible));
}

/**
 * Handler for the button and editbox's OnClicked delegate; Used to show the combobox list.
 *
 * @param EventObject	Object that issued the event.
 * @param PlayerIndex	Player that performed the action that issued the event.
 *
 * @return	return TRUE to prevent the kismet OnClick event from firing.
 */
function bool ShowListClickHandler( UIScreenObject EventObject, int PlayerIndex )
{
	local bool bResult;

//	`log(" >>>>" @ `location@`showobj(EventObject)@`showvar(ComboList.IsVisible(),ComboListVisible));
	if ( ComboList != None )
	{
		ShowList(PlayerIndex);

		// now clear the OnClicked delegate because if the user clicks the button or editbox again to close the list, the act of clicking
		// the button will automatically hide the list as a result of the list losing focus.
		UIObject(EventObject).OnClicked = None;

		// don't fire the kismet on click event.
		bResult = true;
	}

//	`log(" <<<<" @ `location@`showobj(EventObject)@`showvar(ComboList.IsVisible(),ComboListVisible));
	return bResult;
}

/**
 * Handler for the editbox's OnValueChanged delegate.  Called when the user types text into the editbox.
 *
 * @param	Sender			the UIObject whose value changed
 * @param	PlayerIndex		the index of the player that generated the call to this method; used as the PlayerIndex when activating
 *							UIEvents; if not specified, the value of GetBestPlayerIndex() is used instead.
 */
function EditboxTextChanged( UIObject Sender, int PlayerIndex )
{
	//@todo - verify that the editbox isn't set to be read-only?
	NotifyValueChanged(PlayerIndex, TEXT_CHANGED_NOTIFY_MASK);
}

/**
 * Handler for the list's OnValueChanged delegate.  Called when the list's index changes.
 *
 * @param	Sender			the UIObject whose value changed
 * @param	PlayerIndex		the index of the player that generated the call to this method; used as the PlayerIndex when activating
 *							UIEvents; if not specified, the value of GetBestPlayerIndex() is used instead.
 */
function SelectedItemChanged( UIObject Sender, int PlayerIndex )
{
	local string SelectedItemText;

//	`log(`location@`showobj(Sender));
	if ( ComboEditbox != None && Sender == ComboList && ComboList != None && ComboList.IsHidden() )
	{
		// retrieve the text for the selected element
		SelectedItemText = ComboList.GetElementValue(ComboList.Index);

		// now change the editbox's text to this value
		SetEditboxText(SelectedItemText, PlayerIndex, true, true);

		NotifyValueChanged(PlayerIndex, INDEX_CHANGED_NOTIFY_MASK);
	}
}

/**
 * Called when the user presses Enter (or any other action bound to UIKey_SubmitListSelection) while this list has focus.
 *
 * @param	Sender	the list that is submitting the selection
 */
function ListItemSelected( UIList Sender, optional int PlayerIndex=GetBestPlayerIndex() )
{
//	`log(`location@`showobj(Sender));
	if ( ComboEditbox != None )
	{
		// update the editbox's text; prevent the list from firing the OnValueChanged notification since we'll do that after
		// we update everything.
		SetEditboxText( Sender.GetElementValue(Sender.Index), PlayerIndex, true, true );

		HideList();
		ComboEditbox.SetFocus(None, PlayerIndex);

		NotifyValueChanged(PlayerIndex, INDEX_CHANGED_NOTIFY_MASK);
	}
}

/**
 * Handler for GetTextValue action.
 */
function OnGetTextValue( UIAction_GetTextValue Action )
{
	if ( ComboEditbox != None )
	{
		ComboEditbox.OnGetTextValue(Action);
	}
}

// @todo ronp - all accessors for settings and retrieving the value of this combobox, by value or by index

defaultproperties
{
   ComboEditboxClass=Class'Engine.UIEditBox'
   ComboButtonClass=Class'Engine.UIToggleButton'
   ComboListClass=Class'Engine.UIList'
   CaptionDataSource=
   PrivateFlags=1024
   bSupportsPrimaryStyle=False
   Position=(Value[2]=256.000000,Value[3]=32.000000,ScaleType[2]=EVALPOS_PixelOwner,ScaleType[3]=EVALPOS_PixelOwner)
   DefaultStates(2)=Class'Engine.UIState_Active'
   DefaultStates(3)=Class'Engine.UIState_Focused'
   DefaultStates(4)=Class'Engine.UIState_Pressed'
   Begin Object Class=UIComp_Event Name=WidgetEventComponent ObjName=WidgetEventComponent Archetype=UIComp_Event'Engine.Default__UIObject:WidgetEventComponent'
      ObjectArchetype=UIComp_Event'Engine.Default__UIObject:WidgetEventComponent'
   End Object
   EventProvider=WidgetEventComponent
   Name="Default__UIComboBox"
   ObjectArchetype=UIObject'Engine.Default__UIObject'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: tr 31-1-2018 17:18:10.000 - Creation time: sk 18-3-2018 10:01:16.513 - Created with UnCodeX