Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the...

17
Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson . opyright 2000 by L.M. Linson, all rights reserved

Transcript of Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the...

Page 1: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Lessons Learned(from the Simple HTML Editor)

A Presentation for the

Microsoft Access SIG

of the North Texas PC User Group

by Larry Linson

.© Copyright 2000 by L.M. Linson, all rights reserved

Page 2: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Specifications

Prepare a Microsoft Access database Simple text editor for SIG Leader Allow addition of new records Allow deletion of existing records Allow editing of new and existing records

Page 3: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Specifications

Automate insertion of HTML markup– <P> for paragraph– <BR> for break (new line)– <B> for bold– <I> for italic– <A> for link or anchor

Supply appropriate ending markup

Page 4: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

The Plan . . .

Main form allows:– Display– Selection– Addition– Deletion– Editing

Click button for function

Page 5: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

The Plan, cont’d

Popup Form for Link– Universal Resource Locator (URL)– Option to open in new Window– Text to be displayed

Anchor markup deferred (not to be done)

Page 6: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Seems Simple Enough . . .

Combo Box for Selection Text Box for Title / Identification Text Box for Date (default to Today) Text Box for HTML Text Buttons for Add, Delete, Close, Markup

Page 7: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Seems Simple Enough, cont’d

Processing markup– when a Markup button is clicked

– use the Text Box .SelStart and .SelLength properties to

– Split the text,

– Insert the beginning markup,» precede by new line if <P> or <B>

– Reinsert highlighted text, if appropriate,

– Insert the ending markup, if appropriate,

– Append the remainder of the original

Page 8: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Seems Simple Enough, cont’d Processing a Link

– When the Link button is clicked

– Open the popup, dialog Form

– Text Box for URL

– Disabled Selection, Text Boxes for Anchor

– Text Box for Display Text

– OK Button

– Cancel Button

Page 9: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Seems Simple Enough, cont’d Processing a Link

– Display the highlighted text in URL Text Box

– Display the highlighted text in Display Text Box» if no text was highlighted, leave both empty

– Allow Cancel

– If OK, create a link of the form<A href=“http://www.abc.com” target = “_new”> Site Name </A>

– where href contains contents of URL Text Box

– “Site Name” is contents of Display Text Box

Page 10: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Seems Simple Enough, cont’d When done with any markup, return the

cursor To the HTML Text Box on the main Form With the originally highlighted text still

highlighted Except, if a Link, with the Display Text

highlighted

Page 11: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Let’s Take a Look

at how the

SIG Leaders HTML Editor

turned out

Page 12: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

First Lesson Learned When you move off a TextBox

– Highlighting vanishes– No SelStart– No SelText

Workaround– Save SelStart and SelText in the LostFocus

event

Page 13: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Another Lesson Learned When you store modified text

– Back into the text box– You are back at the beginning – Nothing highlighted

Workaround– Modify the saved SelStart and SelText values

and reset them so the same text is highlighted as before the markup

Page 14: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Side Lesson When you reset the SelStart and SelText

– Highlighted code will be visible– But not where you left it positioned – May be at bottom of box

Workaround– I couldn’t find one

Page 15: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Yet Another Lesson Learned Vanishing highlights

– If the modal popup dialog had been used– Sometimes no SelStart and SelText– Why? I didn’t figure it out!

Workaround– Save SelStart and SelText values in the KeyUp

event instead of Lost Focus

Page 16: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Conclusion

There are some unobvious stumbling blocks There are workarounds for most There are no workarounds for a few You can write an editor in Access BUT There are probably better tools for writing

editors

Page 17: Lessons Learned (from the Simple HTML Editor) A Presentation for the Microsoft Access SIG of the North Texas PC User Group by Larry Linson. © Copyright.

Thank you

Thank you for your kind attention

Please come again And, please . . .

– Gently wake your neighbor before leaving