BBC BASIC for Windows
« New features for utility authors »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:58pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: New features for utility authors  (Read 1670 times)
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx New features for utility authors
« Thread started on: Jan 7th, 2010, 09:31am »

Version 5.91a of BB4W has a couple of new features of particular interest to authors of add-in utilities:
  • The editor now responds to the EM_REPLACESEL message according to the Microsoft documentation, that is 'if there is no current selection, the replacement text is inserted at the current location of the caret'.

    This makes it easier to insert text at a specified position; simply set the insertion point using EMU_SETSEL (message 1041) with the start and end positions of the selection the same, then send the text with EM_REPLACESEL.

    Note that EMU_SETSEL works the same way as EM_SETSEL except that the start and end positions are sent as the line number (MS 20 bits) and the character position on the line (LS 12 bits).

  • The EMU_CURSOR message (1032) now allows you to set the mouse pointer to any of the standard shapes. Simply set wParam to a non-zero value and lParam to one of the IDC_ constants.
Richard.
« Last Edit: Mar 27th, 2011, 9:30pm by admin » User IP Logged

Malcolm
Guest
xx Re: New features for utility authors
« Reply #1 on: Mar 27th, 2011, 5:57pm »


I am having trouble with the EMU_CURSOR message.

I call
SYS"SendMessage", hEdit%, 1031, 1, IDC_WAIT
SYS"SendMessage", hEdit%, WM_SETREDRAW, 0, 0

from another program which disables further selection / highlighting and freezes the window but leaves the text editing caret. Should I expect this? If I want to show a busy mouse pointer is there more I have to do?

Malcolm.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: New features for utility authors
« Reply #2 on: Mar 27th, 2011, 9:36pm »

on Mar 27th, 2011, 5:57pm, Guest-Malcolm wrote:
Should I expect this? If I want to show a busy mouse pointer is there more I have to do?

EMU_CURSOR is message 1032, not 1031 (and I've redacted embarrassing evidence to the contrary embarassed).

Richard.
User IP Logged

Malcolm
Guest
xx Re: New features for utility authors
« Reply #3 on: Mar 28th, 2011, 03:26am »

Thanks, Richard.

Unfortunately the use of WM_SETREDRAW seem to undo this call, so you don't seem to be able to show a WAIT cursor and have the IDE frozen to stop automatic scrolling from line insertions until they were complete. It was in an attempt to let the user know that the IDE was temporarily unavailable that I was going to change the mouse pointer.

regards,
Malcolm

User IP Logged

Malcolm
Guest
xx Re: New features for utility authors
« Reply #4 on: Mar 28th, 2011, 04:17am »

Additionally, calling EMU_CURSOR messages removes any IDE selections made at the time.

Malcolm.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: New features for utility authors
« Reply #5 on: Mar 28th, 2011, 08:53am »

on Mar 28th, 2011, 03:26am, Guest-Malcolm wrote:
Unfortunately the use of WM_SETREDRAW seem to undo this call

I don't process WM_SETREDRAW at all, so any effects you see from that message are the default Windows processing, and out of my control. I'm a little surprised if it changes the mouse cursor - nothing in the Microsoft docs suggests that it will.

Quote:
Additionally, calling EMU_CURSOR messages removes any IDE selections made at the time.

Yes, deselection is a side-effect. You could re-select the same region immediately after changing the cursor, although that would cause the IDE to scroll to the selected region (note that other editors, like Notepad, also exhibit this effect).

Quote:
so you don't seem to be able to show a WAIT cursor and have the IDE frozen to stop automatic scrolling from line insertions until they were complete.

The unwanted scrolling presumably occurs because you are inserting the lines individually. If they are a contiguous block of lines, and you insert them in one EM_REPLACESEL or WM_PASTE operation, the IDE automatically delays the screen update until the entire insertion has completed.

Richard.
User IP Logged

Malcolm
Guest
xx Re: New features for utility authors
« Reply #6 on: Mar 28th, 2011, 2:27pm »

Thanks for the comments.

Quote:
I'm a little surprised if it changes the mouse cursor - nothing in the Microsoft docs suggests that it will.


As was I, and I would be delighted if you prove me wrong on this point.

Malcolm.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: New features for utility authors
« Reply #7 on: Mar 28th, 2011, 4:42pm »

on Mar 28th, 2011, 2:27pm, Guest-Malcolm wrote:
I would be delighted if you prove me wrong on this point.

If you perform this sequence:

  1. Change cursor to IDC_WAIT (EMU_CURSOR message)
  2. Disable redraw (WM_SETREDRAW, 0)
  3. Enable redraw (WM_SETREDRAW, 1)
the cursor is still the 'hourglass'. From that I conclude that WM_SETREDRAW isn't changing the cursor shape, but it is preventing the cursor being redrawn when it enters the window.

The practical consequence is likely to be the same (you can't display the hourglass cursor if redrawing is disabled) so you may argue the distinction is academic, but at least it isn't working contrary to the documentation.

Has my suggestion of inserting multiple lines in one 'chunk' made it unnecessary to disable redrawing, and therefore unnecessary to display the hourglass?

Richard.
User IP Logged

Malcolm
Guest
xx Re: New features for utility authors
« Reply #8 on: Mar 28th, 2011, 9:17pm »

Quote:
Has my suggestion of inserting multiple lines in one 'chunk' made it unnecessary to disable redrawing, and therefore unnecessary to display the hourglass?


It is quite possible that it may but I am not sure yet. To retrieve a multi-lined block the clipboard is the only way I could see to do it, or is there another way?
I was getting a line at a time and so inserting only a line at a time or some blank lines for formatting.

Malcolm.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: New features for utility authors
« Reply #9 on: Mar 28th, 2011, 10:26pm »

on Mar 28th, 2011, 9:17pm, Guest-Malcolm wrote:
To retrieve a multi-lined block the clipboard is the only way I could see to do it, or is there another way?

Why would you want to retrieve a multi-lined block? Reading lines (using EM_GETLINE) doesn't result in scrolling or any other display disturbance, so there shouldn't be any issue with doing that one line at a time.

Quote:
I was getting a line at a time and so inserting only a line at a time or some blank lines for formatting.

Obviously I don't know what your code is doing, but I can't see why reading lines one-at-a-time should imply also inserting them individually.

The Windows Constants utility is a good example to follow. The entire program is read one line at a time, but the constant declarations are inserted in one block using WM_PASTE.

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls