• Not Answered

Macro Dialog Not Responding

I am currently writing a macro that will add a task to a string: I have created a dialog and the general framework, but I cannot get the dialog to react when a radio button is selected. I looked at the example in the help, but cannot find any more detailed explanations. The help in the macro editor does not open.

Here's my code. Anyone see what i am doing wrong? The code itself isn't very complex.

''Adds a query as a task to a string.

Dim i As Integer

Sub Main

	'Initialize variables
	Dim prj As PslProject
	Dim trn As PslTransList
	Dim TransString As PslTransString
	Dim TransStringID As String

	'Get active project
	Set prj = PSL.ActiveProject
	If prj Is Nothing Then
	MsgBox("Could not find a selected project. Open a project and run the macro again.",vbOkOnly,"Project Not Found")
	Exit Sub
	End If

	'Get active target list
	Set trn = PSL.ActiveTransList

	If trn Is Nothing Then
  		MsgBox "No active translation list found.",vbOkOnly,"No active Translation List"
  		Exit Sub
	End If

	'Get selected target string
	Set TransString = trn.String(1)

	'Get target string ID
	TransStringID = TransString.ID


	OpenAddQuestionDialog(TransStringID)

End Sub

Function OpenAddQuestionDialog(TransStringID)

	Dim strQuestion As String

	Begin Dialog UserDialog 650,390,"Add Question",.CreateQuestion ' %GRID:10,10,1,1
		CancelButton 490,343,140,28
		PushButton 320,343,150,28,"Add Question",.PushButton1
		TextBox 40,230,580,100,.QuestionText,1

		GroupBox 10,10,600,200,"Select a question type:",.GroupBox1

		Text 80,35,540,20,"Meaning not clear",.Text1
		Text 80,65,540,10,"Meaning changed by proofreader?",.Text2
		Text 80,95,540,14,"Proper name or generic term?",.Text3
		Text 80,125,540,14,"Incorrect terminology used?",.Text4
		Text 80,155,540,14,"Inconsistent terminology used",.Text5
		Text 80,185,540,10,"Set to read-only",.Text6
		Text 40,210,580,10,"Question",.Text7

		OptionGroup .Group1
			OptionButton 40,30,20,20,"OptionButton1",.MeaningNotClear
			OptionButton 40,60,20,20,"OptionButton2",.MeaningChanged
			OptionButton 40,90,20,20,"OptionButton3",.ProperNameOrGeneric
			OptionButton 40,120,20,20,"OptionButton4",.IncorrectTerm
			OptionButton 40,150,20,20,"OptionButton5",.InconsistentTerm
			OptionButton 40,180,20,20,"OptionButton6",.SetReadOnly
	End Dialog
	Dim dlg As UserDialog
	If Dialog(dlg) = 0 Then Exit Function

End Function

Private Function CreateQuestion(DlgItem$, Action%, SuppValue&) As Boolean

	Select Case Action%

	Case 1 ' Dialog box initialization

	Case 2 ' Value changing or button pressed

	If DlgItem$ = "IncorrectTerm" Then
		DlgText "QuestionText", "test"
        End If
    'CreateQuestion = True

	Case 3 ' TextBox or ComboBox text changed

	Case 4 ' Focus changed

	Case 5 ' Idle Rem Wait .1 : CreateQuestion = True ' Continue getting idle actions

	Case 6 ' Function key

	End Select

End Function

Any help would greatly be appreicated.

Best regards,

Robert


Related