Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Syntax checking in text box

Posted on 1998-11-10
10
Medium Priority
?
157 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
Independent Software Vendors: 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

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!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…
Suggested Courses

610 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