Solved

Syntax checking in text box

Posted on 1998-11-10
10
149 Views
Last Modified: 2010-05-18
I have a multiline text box which is used to enter ascii code for a printer language. eg.
A100,100,0,5,1,1,N,"data"

I want to provide a syntax prompt in a window like in VB. For example when you type MsgBox, it prompts you for the various parameters.
Is this possible ? How can I do it ?
0
Comment
Question by:bumpy
10 Comments
 
LVL 4

Expert Comment

by:idcanada
ID: 1444098

This isn't an easy question at all,
but I can work with you on this one as I have already started
a sample project to do such a thing.

Their are so many validations to consider,
the Backspace key, up and down arrows must scroll threw the box,
enter must select etc.

Give me you email address and we could work on it togther.




0
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1444099
Ok.... firstly I would use a Rich Text box....

The easiest way to implement that is to use a Code to find the start of the line then count the number of comma's then have a second single line RTB at the top of the form with the syntax promptes.....

If You would like me to ... I could probably modify the code for  the 'RTF cursor position' routine... that'd work ok...
MAVERICK
 
0
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1444100
Actually It is a fairly easy Question... if you have the code snippets available .....

BTW arn't you supposed to answer the Question ... when you submit the answer......

If you would like to ask any questions regarding my previous comments ... my ICQ is 6631387.. call me!

0
 

Author Comment

by:bumpy
ID: 1444101
Maverick's idea of another single line RTB was good.
This could work. I would like to see the code for the cursor line position.

I had hoped to use a method which looks like the VB method. (It kinda looks nice). I wondered if there is some way of using the tooltips or an api function.



0
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1444102
OK.... I'll find the code.....

BTW where would you like to obtain the syntax from... a *.MDB file ???

My ICQ is 6631387

Regards
Jon

0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 12

Expert Comment

by:mark2150
ID: 1444103
I use the tool tip text property to give advice on a dynamic basis to the user. As you figure out what you want to tell them, place the text into the tool tip property.

M

0
 

Author Comment

by:bumpy
ID: 1444104
Ok Mark, I would like to use the tool tip text property, but how can I show the tool tip after one letter has been typed.
I thought the tool tip only comes up when the mouse is placed over an object.

Bumpy.
0
 

Expert Comment

by:bsvarma
ID: 1444105
if u want to use it using a word application from vb then i can solve this probelm . do mail to me if required
0
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1444106
You still want that RTF position APP?>


0
 
LVL 3

Accepted Solution

by:
jbil earned 200 total points
ID: 1444107
'Not complete but could be starting point

'2 textbox's text1 and text2
'put smaller text2 inside larger text2
'set text2 zorder to 1
'set text2 background color like vb's prompt
'set scalemode to pixles
'run and type "msgbox" and hit space key
Private Declare Function GetCaretPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
     X As Long
     Y As Long
End Type

Private Sub Form_Load()
Me.Show
Text1.SetFocus

End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim caret As POINTAPI
Dim mystring As String
Dim mypos As Integer

GetCaretPos caret
'Debug.Print KeyCode
Select Case KeyCode

Case 32
mystring = "msgbox" 'could be array of choices to loop thru and compare
mypos = InStr(1, Text1.Text, mystring, vbTextCompare)
'need better way to check word just typed
If KeyCode = 32 And mypos > 0 Then
Text2.Left = Text1.Left + caret.X + Text1.Font.Size
Text2.Top = (Text1.Top + caret.Y + (Text1.Font.Size * 2))
Text2.Text = "MsgBox(prompt[, buttons] [, title] [, helpfile, context])"
'or sumtin else depending on mystring array
Text2.ZOrder (0)
End If
Case 40
Text2.ZOrder (1)
Case 38
Text2.ZOrder (1)
Case 13
Text2.ZOrder (1)
Case Else
KeyCode = KeyCode
'Text2.ZOrder (1)
End Select

End Sub


0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now