BBC BASIC for Windows
« Cue banners »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:21pm



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: Cue banners  (Read 542 times)
KenDown
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 181
xx Cue banners
« Thread started on: Nov 21st, 2013, 07:35am »

While browsing the wiki the other day I came across these and thought they might be fun. I copied the relevant code straight into my program, called the PROC *after* PROC_showdialog and looked for the results. Nothing.

Hmmmm.

A couple of questions, please: if I RUN the program from the editor will the cue banners show up? The Wiki *seems* to indicate that they won't, but it's not clear.

Do I need a special flag in the PROC_editbox? I normally use &80 but I did try 0 but perhaps something else is necessary?

Any other advice?

Thanks
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Cue banners
« Reply #1 on: Nov 21st, 2013, 09:11am »

on Nov 21st, 2013, 07:35am, KenDown wrote:
While browsing the wiki the other day I came across these and thought they might be fun. I copied the relevant code straight into my program, called the PROC *after* PROC_showdialog and looked for the results. Nothing.

It will almost certainly be because you are running a 64-bit version of Windows. As has been much discussed here and elsewhere, there is a nasty incompatibility whereby Unicode strings must be WORD-aligned when running under WoW64, but they need not be when running under 'genuine' 32-bit Windows.

I have updated that Wiki article to align the strings, so the code should now work (I've tested it here):

http://bb4w.wikispaces.com/Setting+an+edit+box+cue+banner

Richard.
User IP Logged

Malvern
Guest
xx Re: Cue banners
« Reply #2 on: Nov 21st, 2013, 4:21pm »

I have been using this on 64 bit Windows for several years.
Code:
 a$=FNwide(" New Cue")
      SYS "SendMessage",hbox%, EM_SETCUEBANNER ,0,!^a$

      DEF FNwide(A$)
      LOCAL M$
      M$ = STRING$(2*LENA$+2," ")
      SYS "MultiByteToWideChar", 0, 0, A$, -1, !^M$, LENA$+1
      = M$
 


Which is some of Richard's work. If alignment is needed it is done by the string handling perhaps?
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Cue banners
« Reply #3 on: Nov 21st, 2013, 5:42pm »

on Nov 21st, 2013, 4:21pm, Malvern wrote:
If alignment is needed it is done by the string handling perhaps?

No it's not (there's a 50% chance of it being misaligned) and sadly you can expect that code to fail on some systems. The precise circumstances when alignment is and is not required have never been established, but in my own testing of earlier today (Windows 8.1, 64-bits) it definitely was.

Incidentally I don't think your code:

Code:
SYS "SendMessage", hbox%, EM_SETCUEBANNER, 0, !^a$ 

provides any benefit over the more straightforward:

Code:
SYS "SendMessage", hbox%, EM_SETCUEBANNER, 0, a$ 

Richard.
User IP Logged

Malvern
Guest
xx Re: Cue banners
« Reply #4 on: Nov 21st, 2013, 9:00pm »

Thanks for the correction. a$ is simpler and does work fine. Can't see why I didn't write that to start with.

Incidentally I can't make it not work by moving the buffer position on Win7 64 bit. Strange.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Cue banners
« Reply #5 on: Nov 21st, 2013, 9:54pm »

on Nov 21st, 2013, 9:00pm, Malvern wrote:
Incidentally I can't make it not work by moving the buffer position on Win7 64 bit. Strange.

A possible explanation is that drivers are involved as well as Windows itself.

Richard.
User IP Logged

KenDown
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 181
xx Re: Cue banners
« Reply #6 on: Nov 24th, 2013, 06:48am »

Hmmm. No, sorry, still not working.

I'm running Windows XP Professional Version 2002 with service pack 3 installed on an AMD six core processer. I don't know whether that is the version which causes problems?

I have copied and pasted the code directly from the Wiki page (in includes the wc% = wc% + 1 AND -2, which I presume does the word aligning) and have put the call to the proc *after* displaying the dialog box. I have tried both running directly from the programming window and also after compiling the program and saving it to disk.

Should the cue show up when running directly from the programming window?

Do I need any special flag in the PROC_editbox?
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Cue banners
« Reply #7 on: Nov 24th, 2013, 09:35am »

on Nov 24th, 2013, 06:48am, KenDown wrote:
Hmmm. No, sorry, still not working.... I'm running Windows XP Professional

I think that will be why. Although MSDN claims that cue banners work under XP, in practice they are only fully supported in Vista and later. For example, if you have installed support for Asian languages in XP (which I have) cue banners don't work at all.

See this blog post for confirmation:

http://blogs.msdn.com/b/michkap/archive/2006/02/25/538735.aspx

Richard.
User IP Logged

KenDown
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 181
xx Re: Cue banners
« Reply #8 on: Nov 24th, 2013, 5:32pm »

Ah. Thanks, Richard. I'll have to try it on my Vista laptop.
User IP Logged

KenDown
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 181
xx Re: Cue banners
« Reply #9 on: Nov 25th, 2013, 8:09pm »

Hmmmm. I had a thought during the night and have just confirmed it. Mozilla Firefox displays cue banners as large as life, so there must be more to it than just Windows XP Professional.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Cue banners
« Reply #10 on: Nov 25th, 2013, 11:42pm »

on Nov 25th, 2013, 8:09pm, KenDown wrote:
Hmmmm. I had a thought during the night and have just confirmed it. Mozilla Firefox displays cue banners as large as life, so there must be more to it than just Windows XP Professional.

I don't see how you can possibly conclude that. Firefox is a cross-platform application (there are versions for all popular Operating Systems) so it's unlikely to be using the old - and Microsoft would say obsolete - Win32 API internally.

In any case you can't draw a conclusion from how another application behaves, because it may emulate the cue banner another way. It wouldn't be particularly difficult to draw some text in grey, and then clear it as soon as the user types something, which is pretty much all you need to do to reproduce the behaviour of EM_SETCUEBANNER.

Edit: I could do it in Liberty BASIC - which natively supports changing the colour of text in an edit control - in only a few lines.

Richard.
« Last Edit: Nov 25th, 2013, 11:57pm by admin » 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