BBC BASIC for Windows
« Search Results »

Welcome Guest. Please Login or Register.
Nov 21st, 2009, 09:23am




Search Results

Total results: 10


 1   General Board / Re: * key 1 "è" in textedit.bbc  on: Nov 12th, 2009, 5:11pm
Started by Danny72 | Post by Richard Russell
Quote:
I noticed that textedit.bbc doesn't automatically place the cursor in the typing area like notepad does. Is there a simple way to do this?

Try a PROC_setfocus immediately after the call to FN_createwindow:

Code:
      Hedit% = FN_createwindow("EDIT", "", 0, 0, @vdu%!208, @vdu%!212, 0, &200044, 0)
      PROC_setfocus(Hedit%) 

Richard.

 
  Reply Quote Notify of replies

 2   General Board / Re: * key 1 "è" in textedit.bbc  on: Nov 12th, 2009, 4:34pm
Started by Danny72 | Post by Danny72
Thanks very much.
I have implemented the WM_CHAR idea, and it is working perfectly.

I noticed that textedit.bbc doesn't automatically place the cursor in the typing area like notepad does. Is there a simple way to do this?
 
  Reply Quote Notify of replies

 3   General Board / Re: * key 1 "è" in textedit.bbc  on: Nov 12th, 2009, 10:02am
Started by Danny72 | Post by Michael Hutton
Just found it :

In your SDK :
ms-help://MS.LHSMSSDK.1033/MS.LHSWinSDK.1033/Controls/controls/richedit/richeditcontrols/aboutricheditcontrols.htm

look for Rich Edit Shortcut Keys



Ctrl+' (apostrophe) Accent acute After pressing the short cut key, press the appropriate letter (for example a, e, or u). This applies to English, French, German, Italian, and Spanish keyboards only.
Ctrl+` (grave) Accent grave See Ctrl+' comments.
Ctrl+~ (tilde) Accent tilde See Ctrl+' comments.
Ctrl+; (semicolon) Accent umlaut See Ctrl+' comments.
Ctrl+Shift+6 Accent caret (circumflex) See Ctrl+' comments.
Ctrl+, (comma) Accent cedilla See Ctrl+' comments.

So with the above program type
[ctrl+`] then e - "è",

etc

Michael
 
  Reply Quote Notify of replies

 4   General Board / Re: * key 1 "è" in textedit.bbc  on: Nov 12th, 2009, 09:55am
Started by Danny72 | Post by Michael Hutton
You could also use a Rich Edit Control which will allow you to use UNICODE. This code is a shell to expand on...

Code:
      
      MODE 8
      
      :\
      \\ Install libraries
      \
      INSTALL @lib$+"WINLIB"
      INSTALL @lib$+"WINLIB2"
      INSTALL @lib$+"WINLIB5A"
      
      REM!WC
      WM_COMMAND = &111
      CFM_BOLD = &1
      CFM_COLOR = &40000000
      CFM_FACE = &20000000
      CFM_ITALIC = &2
      CFM_SIZE = &80000000
      CFM_STRIKEOUT = &8
      CFM_UNDERLINE = &4
      EM_EXLIMITTEXT = &435
      EM_SETBKGNDCOLOR = &443
      EM_SETCHARFORMAT = &444
      EM_SETEVENTMASK = &445
      EM_SHOWSCROLLBAR = &460
      ENM_CHANGE = &1
      ENM_KEYEVENTS = &10000
      ENM_MOUSEEVENTS = &20000
      ES_AUTOHSCROLL = &80
      ES_AUTOVSCROLL = &40
      ES_MULTILINE = &4
      ES_NOHIDESEL = &100
      SB_HORZ = 0
      SB_VERT = 1
      SCF_ALL = &4
      WS_BORDER = &800000
      _TRUE = 1
      
      REM. Set up menus:
      AM$ = "AppendMenu"
      SYS "CreatePopupMenu" TO H%
      SYS AM$, H%, 0, 20, "&New"
      SYS AM$, H%, 0, 21, "&Open"
      SYS AM$, H%, 0, 22, "&Save"
      SYS AM$, H%, 0, 23, "Save &As"
      SYS AM$, H%, &800, 0, 0
      SYS AM$, H%, 0, 24, "E&xit"
      SYS "CreatePopupMenu" TO E%
      SYS AM$, E%, 0, 30, "&Undo"
      SYS AM$, E%, &800, 0, 0
      SYS AM$, E%, 0, 31, "Cu&t"
      SYS AM$, E%, 0, 32, "&Copy"
      SYS AM$, E%, 0, 33, "&Paste"
      SYS AM$, E%, 0, 34, "De&lete"
      SYS AM$, E%, &800, 0, 0
      SYS AM$, E%, 0, 35, "Select &All"
      SYS "CreatePopupMenu" TO O%
      SYS AM$, O%, 0, 40, "Set &Font"
      SYS "CreateMenu" TO M%
      SYS "SetMenu", @hwnd%, M%
      SYS AM$, M%, 16, H%, "&File"
      SYS AM$, M%, 16, E%, "&Edit"
      SYS AM$, M%, 16, O%, "&Options"
      SYS "DrawMenuBar", @hwnd%
      
      REM Set up RichEdit Control
      DIM CHARFORMAT{cbSize%,          \
      \              dwMask%,          \
      \              dwEffects%,       \
      \              yHeight%,         \
      \              yOffset%,         \
      \              crTextColor%,     \
      \              bCharSet&,        \
      \              bPitchAndFamily&, \
      \              szFaceName&(31),  \
      \              padding&(1)      }
      
      fontsize% = 12
      fontname$ = "Times"
      bckgrdcolour% = &204030 : REM Horrible Greeny colour
      textcolour% = &FFFFFF   : REM White
      
      SYS "LoadLibrary", "RICHED20.DLL" TO hRichEditDLL%
      IF hRichEditDLL%=0 THEN ERROR 100,"Failed to load MSFTEDIT.DLL"
      
      id_richedit% = 100
      
      hRichEdit% = FN_createwindow(@hwnd%,       \
      \                      "RichEdit20A",                             \
      \                      "",                                                \
      \                      @vdu%!208/2,                            \
      \                      0,                                                \
      \                      @vdu%!208-@vdu%!208/2,          \
      \                      @vdu%!212-20,                          \
      \                      id_richedit%,                               \
      \                      WS_BORDER OR ES_MULTILINE OR ES_AUTOHSCROLL OR ES_AUTOVSCROLL OR ES_NOHIDESEL, \
      \                      0                  )
      
      :\
      \\ Set Richedit FONT
      \
      CHARFORMAT.cbSize% = DIM(CHARFORMAT{})
      CHARFORMAT.dwMask% = CFM_BOLD OR CFM_ITALIC OR CFM_UNDERLINE OR \
      \              CFM_STRIKEOUT OR CFM_FACE OR CFM_COLOR OR CFM_SIZE
      CHARFORMAT.dwEffects% = 0
      CHARFORMAT.yHeight% = fontsize%*20
      CHARFORMAT.crTextColor% = textcolour%
      CHARFORMAT.szFaceName&() = fontname$
      SYS "SendMessage", hRichEdit%, EM_SETCHARFORMAT, SCF_ALL, CHARFORMAT{}
      SYS "SendMessage", hRichEdit%, EM_SETBKGNDCOLOR, 0, bckgrdcolour%
      SYS "SendMessage", hRichEdit%, EM_SHOWSCROLLBAR, SB_VERT, _TRUE
      SYS "SendMessage", hRichEdit%, EM_SHOWSCROLLBAR, SB_HORZ, _TRUE
      SYS "SendMessage", hRichEdit%, EM_SETEVENTMASK, 0, ENM_KEYEVENTS OR ENM_MOUSEEVENTS OR ENM_CHANGE
      SYS "SendMessage", hRichEdit%, EM_EXLIMITTEXT, 0, 20000
      
      ON ERROR PROC_Cleanup:PROC_Error:QUIT
      ON CLOSE PROC_Cleanup:QUIT
      
      :\
      \\ Main Loop
      \
      DIM Msg%(2), msg%(2)
      Msg%() = -1
      ON SYS Msg%() = @msg%,@wparam%,@lparam% : RETURN
      
      REPEAT
        
        msg%(0) = INKEY(1)
        SWAP Msg%(), msg%()
        
        CASE msg%(0) OF
          WHEN WM_COMMAND:
            :\
            \\ when the user selects a command item from a menu,
            \\ when a control sends a notification message to its parent window,
            \\ or when an accelerator keystroke is translated.
            \\
            \\ msg%(0) = WM_COMMAND
            \\ msg%(1) = wParam
            \\ msg%(2)  =lParam
            \\
            \\ msg%(1) = high word, 0 Menu, 1 Accelerator, x control
            \\ msg%(1) = low word, IDM_* menu, IDM_* accelerator, control id
            \
            PRINT msg%(0), msg%(1), msg%(2)
            highword% = msg%(1) >> 16
            lowword% = msg%(1) AND &FFFF
            
            CASE msg%(1) OF
                
              WHEN 24:
                PROC_Cleanup
                QUIT
                
            ENDCASE
            
        ENDCASE
      UNTIL FALSE
      
      
      :\
      \\ Free Library at the end
      \
      DEF PROC_Cleanup
      hRichEdit% += 0 : PROC_closewindow (hRichEdit%)
      SYS "FreeLibrary", hRichEditDLL%
      ENDPROC
      
      DEF PROC_Error
      SYS "MessageBox", @hwnd%, REPORT$, STR$ERR, 0
      ENDPROC
 



I suppose it would be 'easy' to get the characters you want with this?

Michael
 
  Reply Quote Notify of replies

 5   General Board / Re: * key 1 "è" in textedit.bbc  on: Nov 12th, 2009, 09:38am
Started by Danny72 | Post by Richard Russell
Quote:
Could you let me know where it might go in the textedit.bbc please.

The simplest solution is to add a new menu:

Code:
      SYS "CreatePopupMenu" TO char%
      SYS "AppendMenu", char%, 0, 232, "è"
      SYS "AppendMenu", char%, 0, 233, "é" 

which you then need to add to the menu bar:

Code:
      SYS "AppendMenu", M%, 16, char%, "&Characters" 

and then, in the main loop, process the messages:

Code:
      WHEN 232,233: SYS "SendMessage", Hedit%, WM_CHAR, K%, 0 

(WM_CHAR is &102).

I still think a toolbar might be nicer, so you can get the accented characters with one mouse click rather then two.

Richard.
 
  Reply Quote Notify of replies

 6   Assembly Language Programming / FPU tutorial. Links  on: Nov 12th, 2009, 09:19am
Started by Michael Hutton | Post by Michael Hutton
A useful FPU link:

http://www.website.masmforum.com/tutorials/fptute/index.html

Michael
 
  Reply Quote Notify of replies

 7   General Board / Re: * key 1 "è" in textedit.bbc  on: Nov 12th, 2009, 09:05am
Started by Danny72 | Post by Danny72
Thanks for the WM_CHAR tip, though I can't seem to find any more info on this in the manual etc.

Could you let me know where it might go in the textedit.bbc please.
To get the character "è", would it be something like WM_CHAR 0232 somewhere?

Danny







rem. A simple text editor in BBC BASIC for Windows, 01-Dec-2006
install @lib$+"WINLIB5"

rem. Set up menus:
AM$ = "AppendMenu"
sys "CreatePopupMenu" to H%
sys AM$, H%, 0, 20, "&New"
sys AM$, H%, 0, 21, "&Open"
sys AM$, H%, 0, 22, "&Save"
sys AM$, H%, 0, 23, "Save &As"
sys AM$, H%, &800, 0, 0
sys AM$, H%, 0, 24, "E&xit"
sys "CreatePopupMenu" to E%
sys AM$, E%, 0, 30, "&Undo"
sys AM$, E%, &800, 0, 0
sys AM$, E%, 0, 31, "Cu&t"
sys AM$, E%, 0, 32, "&Copy"
sys AM$, E%, 0, 33, "&Paste"
sys AM$, E%, 0, 34, "De&lete"
sys AM$, E%, &800, 0, 0
sys AM$, E%, 0, 35, "Select &All"
sys "CreatePopupMenu" to O%
sys AM$, O%, 0, 40, "Set &Font"
sys "CreateMenu" to M%
sys "SetMenu", @hwnd%, M%
sys AM$, M%, 16, H%, "&File"
sys AM$, M%, 16, E%, "&Edit"
sys AM$, M%, 16, O%, "&Options"
sys "DrawMenuBar", @hwnd%

rem. Create edit window:
Hedit% = fn_createwindow("EDIT", "", 0, 0, @vdu%!208, @vdu%!212, 0, &200044, 0)

rem. Create and initialise data structures for dialogue boxes:
dim Fn% 255, Lf% 59
dim fs{lStructSize%, hwndOwner%, hInstance%, lpstrFilter%, \
\ lpstrCustomFilter%, nMaxCustFilter%, nFilterIndex%, \
\ lpstrFile%, nMaxFile%, lpstrFileTitle%, \
\ nMaxFileTitle%, lpstrInitialDir%, lpstrTitle%, \
\ flags%, nFileOffset{l&,h&}, nFileExtension{l&,h&}, \
\ lpstrDefExt%, lCustData%, lpfnHook%, lpTemplateName%}
ff$ = "TXT files"+chr$0+"*.TXT"+chr$0+"All files"+chr$0+"*.*"+chr$0+chr$0
ex$ = "txt"
fs.lStructSize% = !!^fs{}
fs.hwndOwner% = @hwnd%
fs.lpstrFilter% = !^ff$
fs.lpstrDefExt% = !^ex$
fs.lpstrFile% = Fn%
fs.nMaxFile% = 256
fs.flags% = 6

dim cf{lStructSize%, hwndOwner%, hdc%, lpLogFont%, \
\ iPointSize%, flags%, rgbColors%, lCustData%, \
\ lpfnHook%, lpTemplateName%, hInstance%, lpszStyle%, \
\ nFontType{l&,h&}, pad{l&,h&}, nSizeMin%, nSizeMax%}
cf.lStructSize% = !!^cf{}
cf.hwndOwner% = @hwnd%
cf.lpLogFont% = Lf%
cf.flags% = 1

rem. Set up 'interrupts':
Menu% = 0
on close if fnchanged procexit else return
on move procmove(@msg%, @wparam%, @lparam%) : return
on sys Menu% = @wparam% : return
on error sys "MessageBox", @hwnd%, report$, 0, 48

rem. Main loop:
repeat
K% = 0 : swap K%, Menu%
F% = true
case K% of
when 20: if fnchanged procnew
when 21: if fnchanged procload
when 22: if fnsave procunchanged
when 23: if fnsaveas procunchanged
when 24: if fnchanged procexit
when 30: sys "SendMessage", Hedit%, &C7, 0, 0
when 31: sys "SendMessage", Hedit%, &300, 0, 0
when 32: sys "SendMessage", Hedit%, &301, 0, 0
when 33: sys "SendMessage", Hedit%, &302, 0, 0
when 34: sys "SendMessage", Hedit%, &303, 0, 0
when 35: sys "SendMessage", Hedit%, &B1, 0, -1
when 40: procfont
otherwise: F% = false
endcase
if F% sys "SetForegroundWindow", Hedit%
wait 1
until false
end

def procexit
proc_closewindow(Hedit%)
quit

def procmove(M%, W%, L%)
if M%=5 sys "MoveWindow", Hedit%, 0, 0, L% and &FFFF, L% >> 16, 1
endproc

def procfont : local F%, R%
sys "ChooseFont", cf{} to R%
if R% then
sys "SendMessage", Hedit%, &31, 0, 0 to F%
if F% sys "DeleteObject", F%
sys "CreateFontIndirect", cf.lpLogFont% to F%
sys "SendMessage", Hedit%, &30, F%, 1
endif
endproc

def procnew : local F%
?Fn% = 0 : proctitle
sys "SendMessage", Hedit%, &C, 0, ^F%
endproc

def procload : local F%, L%
sys "GetOpenFileName", fs{} to F%
if F% proctitle else endproc
F% = openin$$Fn%
if F% then
L% = ext#F% : close #F%
sys "GlobalAlloc", 0, L%+1 to F%
oscli "LOAD """+$$Fn%+""" "+str$~F%+"+"+str$~L%
F%?L% = 0
sys "SendMessage", Hedit%, &C, 0, F% to L%
sys "GlobalFree", F%
if L% = 0 error 100, "File "+$$Fn%+" too big"
else
error 101, "Can't open file "+$$Fn%
endif
endproc

def fnsaveas : local F%, L%
sys "GetSaveFileName", fs{} to F%
if F% proctitle else = false
def fnsave : local F%, L% : if ?Fn% = 0 then = fnsaveas
sys "SendMessage", Hedit%, &E, 0, 0 to L%
sys "GlobalAlloc", 0, L%+1 to F%
sys "SendMessage", Hedit%, &D, L%+1, F%
oscli "SAVE """+$$Fn%+""" "+str$~F%+"+"+str$~L%
sys "GlobalFree", F%
= true

def fnchanged : local R%
sys "SendMessage", Hedit%, &B8, 0, 0 to R%
if R% = 0 then = true
sys "MessageBox", @hwnd%, "Save changes?", "TEXTEDIT", 35 to R%
if R% = 6 if fns procunchanged : = true
if R% = 7 procunchanged : = true
= false

def proctitle
sys "SetWindowText", @hwnd%, "TEXTEDIT - "+$$Fn%
endproc

def procunchanged
sys "SendMessage", Hedit%, &B9, 0, 0
endproc

 
  Reply Quote Notify of replies

 8   General Board / Re: * key 1 "è" in textedit.bbc  on: Nov 11th, 2009, 11:14pm
Started by Danny72 | Post by Richard Russell
Quote:
Is it possible to have an extra pop-up menu on
textedit.bbc which would then display the accented character, when clicked?

Yes, that's straightforward. You could go further and have a toolbar (maybe a floating toolbar) with the accented characters all 'continuously' available with a single click of the mouse. When you want to insert the character, just send an appropriate WM_CHAR message to the edit control.

Richard.

 
  Reply Quote Notify of replies

 9   General Board / Re: * key 1 "è" in textedit.bbc  on: Nov 11th, 2009, 8:31pm
Started by Danny72 | Post by Danny72
Is it possible to have an extra pop-up menu on
textedit.bbc which would then display the accented character, when clicked?

thanks

Danny

 
  Reply Quote Notify of replies

 10   General Board / Re: * key 1 "è" in textedit.bbc  on: Nov 11th, 2009, 6:17pm
Started by Danny72 | Post by Richard Russell
Quote:
I have tried putting in the code *key 1 "è"
as an easy way to input foreign accents but it doesn't seem to recognise it in the program.

TEXTEDIT.BBC spawns a Windows Edit Control, and doesn't use BBC BASIC for its keyboard input. As a result things like *KEY and *EXEC can't work (they are part of BASIC). Effectively, it works exactly as NOTEPAD does (which also uses a standard Edit Control).

However, for the same reason, the 'official' Windows shortcuts for accented characters etc. do work. For example if you have enabled the US-International Keyboard or the UK Extended Keyboard you can generate è by typing `e. If you have a French keyboard there's a key for it (the '7' key). Failing any of those, you can type Alt-0232 (Hold down Alt, type 0232 on the numeric keypad, release Alt).

For more information:
http://support.microsoft.com/default.aspx?scid=kb;en-us;306560&sd=tech#2
http://french.about.com/od/writing/ss/typeaccents.htm

If you're really determined you could probably make F1 work by re-engineering TEXTEDIT.BBC to use a docked dialogue box, using the WINLIB2B library (which includes a special function FN_newdialogaccel() that takes an additional parameter) and creating an Accelerator Table which performs the necessary translation. An interesting challenge!

Richard.
 
  Reply Quote Notify of replies



New Monthly Ad-Free Plan!

$6.99 Gets 50,000 Ad-Free Pageviews!
| Free Shoutboxes | Hookah |

This Board Hosted For FREE By Conforums ©
Get Your Own Free Message Board!