Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,127
    I've just checked & do have Key Preview = Yes but can still enter text even if I change that to No! However Ctrl+Enter only works when it is Yes.

    Glad to hear you now have a working web browser control but for the benefit of other forum members, please:


    a) provide a link to the article by Stephen Lebans that you used as a starting point
    b) upload your solution

    Also it appears you didn't look at my example app from post #15 as it shows there have been no downloads.
    I'd be interested to know what you think of that & whether it would do what you need 'out of the box'
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  2. #17
    journeyman is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Dec 2022
    Posts
    85

    Example DB Web browser control formatting

    All,

    The attached is my current solution to working with a web browser control (Active X).

    It should be noted that the core solution came from research into a design by Stephen Lebans.

    See: https://lebans.com/htmleditor.htm

    The answer to getting keypresses working appears to be based in how the webbrower relates to the from the control is housed on - the form keypress event is triggered - is sent to the SendEnterKey function, which does some kinda funkery that wasn't explained (hopefully somebody else might be able to provide a commentary on what's happening and how.). In any case, the function seems to allow for text to be modified on the control.

    Stephens' copy is far more comprehensive and contains many more features. Mine is simply a cut down version designed to understand the basics of getting it up and running.

    The reasons for this is to permit external buttons to trigger text formatting. The Rich Textbox does provide text formatting, but requires the user to highlight the text and make use of the MS RTB popup.

    However, the use of the web browser control allows for far more functionality that the RTB provides, including clicking buttons to trigger events.

    Note: There is another solution that uses Javascript to handle the HTML editing. It's an awesome solution. Except that it uses Javascript and I don't know JS. However, it will provide instant functionality out of the box, and is generally easy to work with by anybody with a good understanding of Access.
    See: http://www.cardaconsultants.com (by Daniel Pineault).

    Thanks to all involve in helping. Hope it's of value to someone in the future.

    Example: WB Demo.zip

  3. #18
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,127
    Thank you for providing that info / example app to help others in the future

    Although I don't remember doing so, I must have used Stephen Lebans example at least as a starting point for my code as I noticed the same designs for several of the buttons.
    However I did add a few extra items such as tables, images, lines, hyperlinks etc which are specific to HTML (i.e. not available in rich text)

    Daniel Pineault's website has certainly changed since I last looked at it. However I was unable to find his Javascript example that you mentioned. Is it on that site or his Devhut.net site?

    Anyway, you've done well creating that example which seems to work well in my quick testing.

    Just a few things I noticed that you may wish to follow up:
    1. On first use, the form has to be first opened in design view before it can be opened in form view. After that it works normally. I didn't investigate why first use is different.
    2. Although it runs in 64-bit, I noticed a few errors in your API conversion for 64-bit e.g. handles such as hWnd need to be LongPtr. Not sure whether that affects any of your functionality
    3. Some rich text functionality available in the popup toolbar is missing in your example. For example:
    a) There is no dropdown to select font name
    b) No buttons for left/centre/right alignment

    Nevertheless congratulations on getting this to work for your purposes
    Last edited by isladogs; 08-11-2023 at 12:30 PM.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  4. #19
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,127
    Just to say that following on from this thread, I've now used a similar idea to extract VBA code from all procedures in external databases and then automatically format the code to show the comment lines in green.
    I had spent a couple of hours unsuccessfully trying to get it to work in a rich text box - in the end I used the ActiveX web browser to display the code with colour formatting

    Below is a randomly chosen procedure from Northwind 2 Dev edition

    Click image for larger version. 

Name:	Capture.PNG 
Views:	14 
Size:	50.1 KB 
ID:	50643

    Thanks for posting this thread as, without this as a memory aid, I probably wouldn't have thought of using the web browser control
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  5. #20
    journeyman is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Dec 2022
    Posts
    85
    Okay, awesome. Glad you got some benefit from it. I was thinking of doing something similar with the HTML coding behind the WYSiWYG.

    Note: I did not include various functionality in my example (i.e Justify, fonts, etc) simply because I removed them from the example. I could go insane for the amount of functionality that I could add to this.

    I plan to add tables and other things once I figure out how to do it without deleting everything. I'm thinking of putting the buttons into a class module and see if that might lighten things up.

    It's a nice project and I'm having fun with it.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 06-18-2021, 04:22 PM
  2. Rich text field not displaying rich text properly
    By CodeLiftSleep in forum Access
    Replies: 4
    Last Post: 01-24-2018, 10:59 AM
  3. Replies: 3
    Last Post: 06-04-2017, 01:02 PM
  4. Replies: 4
    Last Post: 08-07-2015, 07:49 AM
  5. Replies: 1
    Last Post: 03-13-2012, 08:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums