Solved

Syntax checking in text box

Posted on 1998-11-10
10
153 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

792 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