?
Solved

Syntax checking in text box

Posted on 1998-11-10
10
Medium Priority
?
156 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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 600 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month10 days, 9 hours left to enroll

765 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