#3322 "javascript ONCHANGE handler failures". Added ControlChanged() in order to send NS_CONTROL_CHANGE events.
git-svn-id: svn://10.0.0.236/trunk@33911 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
82f9a59a36
commit
be10af10cd
@ -97,6 +97,9 @@ NS_IMETHODIMP nsComboBox::Create(nsIWidget *aParent,
|
||||
popupData->mID = mMenuID;
|
||||
}
|
||||
#endif
|
||||
::SetControlMinimum(mControl, 0);
|
||||
::SetControlMaximum(mControl, 0);
|
||||
::SetControlValue(mControl, 0);
|
||||
EndDraw();
|
||||
}
|
||||
else
|
||||
@ -340,6 +343,7 @@ PRBool nsComboBox::DispatchMouseEvent(nsMouseEvent &aEvent)
|
||||
thePoint.h = aEvent.point.x;
|
||||
thePoint.v = aEvent.point.y;
|
||||
::TrackControl(mControl, thePoint, nil);
|
||||
ControlChanged(::GetControlValue(mControl));
|
||||
//¥TODO: the mouseUp event is eaten by TrackControl.
|
||||
//¥ We must create it and dispatch it after the mouseDown;
|
||||
eatEvent = PR_TRUE;
|
||||
|
||||
@ -101,6 +101,7 @@ NS_IMETHODIMP nsListBox::Create(nsIWidget *aParent,
|
||||
|
||||
mValue = kLDESRsrcID;
|
||||
nsresult res = Inherited::Create(aParent, aRect, aHandleEventFunction, aContext, aAppShell, aToolkit, aInitData);
|
||||
mValue = 0;
|
||||
|
||||
nsMacResources::CloseLocalResourceFile();
|
||||
|
||||
@ -111,10 +112,12 @@ NS_IMETHODIMP nsListBox::Create(nsIWidget *aParent,
|
||||
if (mListHandle)
|
||||
{
|
||||
SetMultipleSelection(mMultiSelect);
|
||||
::SetControlMinimum(mControl, 0);
|
||||
StartDraw();
|
||||
::LSetDrawingMode(mVisible, mListHandle);
|
||||
::SetControlMinimum(mControl, 1);
|
||||
::SetControlMaximum(mControl, 0);
|
||||
::SetControlValue(mControl, 0);
|
||||
::LSetDrawingMode(mVisible, mListHandle);
|
||||
EndDraw();
|
||||
}
|
||||
else
|
||||
res = NS_ERROR_FAILURE;
|
||||
@ -523,6 +526,7 @@ PRBool nsListBox::DispatchMouseEvent(nsMouseEvent &aEvent)
|
||||
EventRecord* osEvent = (EventRecord*)aEvent.nativeMsg;
|
||||
EventModifiers modifiers = (osEvent ? osEvent->modifiers : 0);
|
||||
::LClick(thePoint, modifiers, mListHandle);
|
||||
ControlChanged(GetSelectedIndex());
|
||||
}
|
||||
//¥TODO: the mouseUp event is eaten by TrackControl.
|
||||
//¥ We must create it and dispatch it after the mouseDown;
|
||||
|
||||
@ -41,6 +41,7 @@ nsMacControl::nsMacControl() : nsWindow()
|
||||
mMax = 1;
|
||||
mWidgetArmed = PR_FALSE;
|
||||
mMouseInButton = PR_FALSE;
|
||||
|
||||
mControl = nsnull;
|
||||
mControlType = pushButProc;
|
||||
|
||||
@ -222,6 +223,30 @@ PRBool nsMacControl::DispatchMouseEvent(nsMouseEvent &aEvent)
|
||||
return (Inherited::DispatchMouseEvent(aEvent));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
void nsMacControl::ControlChanged(PRInt32 aNewValue)
|
||||
{
|
||||
if (aNewValue != mValue)
|
||||
{
|
||||
mValue = aNewValue;
|
||||
mLastValue = mValue; // safely assume that the control has been repainted already
|
||||
|
||||
nsGUIEvent guiEvent;
|
||||
nsPoint point(0,0);
|
||||
guiEvent.eventStructType = NS_GUI_EVENT;
|
||||
guiEvent.message = NS_CONTROL_CHANGE;
|
||||
guiEvent.point = point;
|
||||
guiEvent.time = PR_IntervalNow();
|
||||
guiEvent.widget = this;
|
||||
guiEvent.nativeMsg = nsnull;
|
||||
Inherited::DispatchWindowEvent(guiEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@ -60,6 +60,7 @@ protected:
|
||||
NS_METHOD CreateOrReplaceMacControl(short inControlType);
|
||||
virtual void GetRectForMacControl(nsRect &outRect);
|
||||
void SetupMacControlFont();
|
||||
void ControlChanged(PRInt32 aNewValue);
|
||||
|
||||
nsString mLabel;
|
||||
PRBool mWidgetArmed;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user