nsComponentManager::CreateInstance(kTextFieldCID, nsnull, kITextWidgetIID, (void**)&mVerDirTxt);
CallCreateInstance(kTextFieldCID, &mVerDirTxt);
PRBool CreateRobotDialog(nsIWidget * aParent){  PRBool result = PR_TRUE;  if (mRobotDialog != nsnull) {    NS_ShowWidget(mRobotDialog,PR_TRUE);    NS_SetFocusToWidget(mStartBtn);    return PR_TRUE;  }   nsILabel * label;  nsIDeviceContext* dc = aParent->GetDeviceContext();  float t2d;  t2d = dc->TwipsToDevUnits();  nsFont font(DIALOG_FONT, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,              NS_FONT_WEIGHT_NORMAL, 0,              nscoord(t2d * NSIntPointsToTwips(DIALOG_FONT_SIZE)));  NS_RELEASE(dc);  nscoord dialogWidth = 375;  // create a Dialog  //  nsRect rect;  rect.SetRect(0, 0, dialogWidth, 162);    nsComponentManager::CreateInstance(kWindowCID, nsnull, kIWidgetIID, (void**)&mRobotDialog);  if (nsnull == mRobotDialog)  	return PR_FALSE;  nsIWidget* dialogWidget = nsnull;  if (NS_OK == mRobotDialog->QueryInterface(kIWidgetIID,(void**)&dialogWidget))  {    dialogWidget->Create(aParent, rect, HandleRobotEvent, NULL);    NS_RELEASE(dialogWidget);  }    //mRobotDialog->SetLabel("Debug Robot Options");  nscoord txtHeight   = 24;  nscolor textBGColor = NS_RGB(255,255,255);  nscolor textFGColor = NS_RGB(255,255,255);  {    nsCOMPtr<nsILookAndFeel> lookAndFeel = do_GetService(kLookAndFeelCID);    if (lookAndFeel) {      lookAndFeel->GetMetric(nsILookAndFeel::eMetric_TextFieldHeight, txtHeight);      lookAndFeel->GetColor(nsILookAndFeel::eColor_TextBackground, textBGColor);      lookAndFeel->GetColor(nsILookAndFeel::eColor_TextForeground, textFGColor);    }  }    nscoord w  = 65;  nscoord x  = 5;  nscoord y  = 10;  // Create Update CheckButton  rect.SetRect(x, y, 150, 24);  #ifdef USE_LOCAL_WIDGETS  NS_NewCheckButton(&mUpdateChkBtn);#else  nsComponentManager::CreateInstance(kCheckButtonCID, nsnull, kICheckButtonIID, (void**)&mUpdateChkBtn);#endif  NS_CreateCheckButton(mRobotDialog, mUpdateChkBtn,rect,HandleRobotEvent,&font);  mUpdateChkBtn->SetLabel(NS_ConvertASCIItoUCS2("Update Display (Visual)"));  mUpdateChkBtn->SetState(PR_TRUE);  y += 24 + 2;  // Create Label  w = 115;  rect.SetRect(x, y+3, w, 24);  #ifdef USE_LOCAL_WIDGETS  NS_NewLabel(&label);#else  nsComponentManager::CreateInstance(kLabelCID, nsnull, kILabelIID, (void**)&label);#endif  NS_CreateLabel(mRobotDialog,label,rect,HandleRobotEvent,&font);  label->SetAlignment(eAlign_Right);  label->SetLabel(NS_ConvertASCIItoUCS2("Verfication Directory:"));  x += w + 1;  // Create TextField  nsIWidget* widget = nsnull;  rect.SetRect(x, y, 225, txtHeight);  #ifdef USE_LOCAL_WIDGETS  NS_NewTextWidget(&mVerDirTxt);#else  nsComponentManager::CreateInstance(kTextFieldCID, nsnull, kITextWidgetIID, (void**)&mVerDirTxt);#endif  NS_CreateTextWidget(mRobotDialog,mVerDirTxt,rect,HandleRobotEvent,&font);  if (mVerDirTxt && NS_OK == mVerDirTxt->QueryInterface(kIWidgetIID,(void**)&widget))  {    widget->SetBackgroundColor(textBGColor);    widget->SetForegroundColor(textFGColor);  }  nsString str; str.AssignWithConversion(DEBUG_EMPTY);  PRUint32 size;  mVerDirTxt->SetText(str,size);  y += txtHeight + 2;    x = 5;  w = 55;  rect.SetRect(x, y+4, w, 24);  #ifdef USE_LOCAL_WIDGETS  NS_NewLabel(&label);#else  nsComponentManager::CreateInstance(kLabelCID, nsnull, kILabelIID, (void**)&label);#endif  NS_CreateLabel(mRobotDialog,label,rect,HandleRobotEvent,&font);  label->SetAlignment(eAlign_Right);  label->SetLabel(NS_ConvertASCIItoUCS2("Stop after:"));  x += w + 2;  // Create TextField  rect.SetRect(x, y, 75, txtHeight);  #ifdef USE_LOCAL_WIDGETS  NS_NewTextWidget(&mStopAfterTxt);#else  nsComponentManager::CreateInstance(kTextFieldCID, nsnull, kITextWidgetIID, (void**)&mStopAfterTxt);#endif  NS_CreateTextWidget(mRobotDialog,mStopAfterTxt,rect,HandleRobotEvent,&font);  if (mStopAfterTxt && NS_OK == mStopAfterTxt->QueryInterface(kIWidgetIID,(void**)&widget))  {    widget->SetBackgroundColor(textBGColor);    widget->SetForegroundColor(textFGColor);    mStopAfterTxt->SetText(NS_ConvertASCIItoUCS2("5000"),size);  }  x += 75 + 2;  w = 75;  rect.SetRect(x, y+4, w, 24);  #ifdef USE_LOCAL_WIDGETS  NS_NewLabel(&label);#else  nsComponentManager::CreateInstance(kLabelCID, nsnull, kILabelIID, (void**)&label);#endif  NS_CreateLabel(mRobotDialog,label,rect,HandleRobotEvent,&font);  label->SetAlignment(eAlign_Left);  label->SetLabel(NS_ConvertASCIItoUCS2("(page loads)"));  y += txtHeight + 2;    y += 10;  w = 75;  nscoord xx = (dialogWidth - (2*w)) / 3;  // Create Find Start Button  rect.SetRect(xx, y, w, 24);  #ifdef USE_LOCAL_WIDGETS  NS_NewButton(&mStartBtn);#else  nsComponentManager::CreateInstance(kButtonCID, nsnull, kIButtonIID, (void**)&mStartBtn);#endif  NS_CreateButton(mRobotDialog,mStartBtn,rect,HandleRobotEvent,&font);  mStartBtn->SetLabel(NS_ConvertASCIItoUCS2("Start"));    xx += w + xx;  // Create Cancel Button  rect.SetRect(xx, y, w, 24);  #ifdef USE_LOCAL_WIDGETS  NS_NewButton(&mCancelBtn);#else  nsComponentManager::CreateInstance(kButtonCID, nsnull, kIButtonIID, (void**)&mCancelBtn);#endif  NS_CreateButton(mRobotDialog,mCancelBtn,rect,HandleRobotEvent,&font);  mCancelBtn->SetLabel(NS_ConvertASCIItoUCS2("Cancel"));    NS_ShowWidget(mRobotDialog,PR_TRUE);  NS_SetFocusToWidget(mStartBtn);  return result;}