Fellow Microstation Programmers,
When doing a find/replace Microstation pops-up an application modal dialog box but doesn't "kick-off" the IModalDialogEvents. Does anyone know how to either:
1. Prevent the dialog from activating?
or
2. Close the dialog once it has been activated?
Code is as follows:
Private Sub mSubReplaceText(StrFindText As String, StrReplaceText As String)
' Start a command
CadInputQueue.SendCommand "MDL KEYIN FINDREPLACETEXT,CHNGTXT CHANGE DIALOGTEXT"
' Send a keyin that can be a command string
CadInputQueue.SendKeyin "FIND DIALOG SEARCHINCELLS True"
CadInputQueue.SendKeyin "FIND DIALOG PAN True"
CadInputQueue.SendKeyin "FIND DIALOG ZOOM True"
CadInputQueue.SendKeyin "FIND DIALOG ZOOMLEVEL 100"
CadInputQueue.SendKeyin "FIND DIALOG SEARCHSTRING " & StrFindText
CadInputQueue.SendKeyin "FIND DIALOG REPLACESTRING " & StrReplaceText
Dim modalHandler As New clsModalHandler
AddModalDialogEventsHandler modalHandler
CadInputQueue.SendKeyin "CHANGE TEXT ALLFILTERED"
CommandState.StartDefaultCommand
End Sub
Thanks in advance,
Christmas May
.
Try Silentload FindReplaceText...
Sub replaceNumber(oldStr, newStr)
Dim str1 As String
Dim str2 As String
str1 = "FIND DIALOG SEARCHSTRING " + oldStr
str2 = "FIND DIALOG REPLACESTRING " + newStr
CadInputQueue.SendKeyin str1
CadInputQueue.SendKeyin str2
CadInputQueue.SendKeyin "CHANGE TEXT ALL"
Sub StartFndRepSS()
CadInputQueue.SendCommand "MDL SILENTLOAD FINDREPLACETEXT"
Call replaceNumber("STREET", "ST. ")
Unknown said:When doing a find/replace Microstation pops-up an application modal dialog box but doesn't "kick-off" the IModalDialogEvents
The Find/Replace Text dialog is modeless, not modal. When the dialog is visible, you can continue to do other things; a modal dialog would stop you doing other things.
A modeless dialog has nothing to do with the IModalDialogEvents interface.
Regards, Jon Summers LA Solutions
There is an existng change request for user/programatic interaction with the Find/Replace dialog. At this point there are no work-arounds other than to perform your own find and replace operations which can get tricky depending on the text element type and features you need to interact with.
(CR 324500). Request to add MicroStation configuration variable, keyin, or user preference to disallow the modal search dialog box from being presented in MicroStation Find/Replace text and present results to the message center.
I should have been more clear. It isn't the actual find/replace box. Instead it is the "Search Completed" pop-up upon completion. I still believe it to be modal since I can't do anything in Microstation until I close that box.
Hi,
Change your first line to
CadInputQueue.SendKeyin "MDL KEYIN FINDREPLACETEXT"
Also, you should not need pan, zoom, zoomlevel for changing all occurances. These would only be used for manually searching.
--Robert
Answer Verified By: Christmas050873
Robert Arnold,
That fixed my problem. However, I now have a follow up question.
1. What is the difference and why does this work?
Hi Christmas,
My command loads the Find & Replace MDL, but does not bring up the dialog box. If the dialog box does not appear, when you "Change text all filtered", it never brings up any dialog box. If you open the main find and replace dialog box, then the MDL sees that its dialog is open and will bring up the "all done" message.