LB Booster
General >> General Board >> pressing ESC aborts the program
http://lbb.conforums.com/index.cgi?board=general&action=display&num=1473759070

pressing ESC aborts the program
Post by metro on Sep 13th, 2016, 09:31am

in need of assistance,
my first post, after downloading LBB today I decided to load up a LB 4.5*.bas program I have put together to download option quotes from the Australian Stock Market web site (ASX) . It works fine in LB!
I have altered some code that prevented me from running it from the LBB IDE (namely HTTPGET$ to httpget$ and others),

But I have a mystery I can solve.

If I press the keyboard's "ESC" key once the program has loaded the program aborts with no further warning, (the IDE is still running though)
however if I make a selection from one of the list boxes I do not have the issue.
the same problem exists after compiling too.
any ideas??
Re: pressing ESC aborts the program
Post by Richard Russell on Sep 13th, 2016, 11:03am

on Sep 13th, 2016, 09:31am, metro wrote:
If I press the keyboard's "ESC" key once the program has loaded the program aborts with no further warning

The Esc key should work as it normally does in Windows, that is in a DIALOG type window pressing Esc should behave the same as clicking on the Close box, but otherwise it should be ignored. For example try this program:

Code:
    open "Test" for dialog as #w
    #w "trapclose quit"
    wait

sub quit h$
    print "Close was clicked or Esc pressed"
end sub 

If you think something different is happening please list a (preferably short) program which demonstrates the issue.

Richard.

Re: pressing ESC aborts the program
Post by metro on Sep 13th, 2016, 1:25pm

Quote:
(preferably short)

Sorry Richard its not short, I have taken the code up to the first WAIT
and rem'd out lines that would stop it running.
It is still work in progress however as stated before I have no issues in LB4.5
just an aside, I cant believe how much faster it runs using LBB.
if you simply press "Esc" when the program opens it will immediately close

I can make the whole program available through dropbox if that helps
however there is a SQLite DB so the whole thing in 1.6mb

Code:
  nomainwin
    'Form created with the help of Freeform 3 v07-15-08
    'Generated on Nov 17, 2015 at 17:02:38

    sep$       =chr$(34)+chr$(44)+chr$(34)   :Blank$=Chr$(34)+"C"+Chr$(34) :Str1$ =")"+chr$(34)+">"
    MyEol$     =chr$(44)+chr$(34)+chr$(34)   :DDQ$  =Chr$(34)+Chr$(34)
    ControlDir$=DefaultDir$+"\CTRL\"
    DataDir$   =DefaultDir$+"\DAT\"

    GLOBAL AsxCode$ , Dquote$,Str1$
    GLOBAL OptType$ ,TransType$

[setup.main.Window]

  '  loadbmp "BannerImage", ControlDir$+"financeBanner.bmp"

    '-----Begin code for #buy



    MainWinWidth = 800
    MainWinHeight = 600

    WindowWidth = MainWinWidth
    WindowHeight = MainWinHeight
    UpperLeftX=int((DisplayWidth-WindowWidth)/2)
    UpperLeftY=int((DisplayHeight-WindowHeight)/2)


    '-----Begin GUI objects coderecord
    graphicbox   #buy.GbLine3,   3,   1, 785,  3
    graphicbox   #buy.GbBanner,   3,   5, 785,  60
    graphicbox   #buy.GbLine1,   3,   66, 785,  3

    TextboxColor$ = "white"

    statictext  #buy.StPFolio,"Portfolio"    ,       20,  75,  65,  20
    combobox    #buy.CbPFolio, PFolio$(), [SelPFolio],  10,  95, 150,  25

    statictext  #buy.StBroker,"Broker"    ,           190,  75,  65,  20
    combobox    #buy.CbBroker, Brokers$(), [SelBroker],  175,  95, 100,  25

    statictext  #buy.StOpenDate, "Open Date",  20,  125,  65,  20
    textbox     #buy.TbOpenDate,                  10,  145, 100,  25

    statictext  #buy.StOptCode, "Opt Code",  140, 125,  57,  20
    textbox     #buy.TbOptCode,              120, 145, 100,  25
    Stylebits   #buy.TbOptCode, _ES_UPPERCASE, 0, 0, 0

    button      #buy.Btnfind  , "FIND", [SEARCH4CODE], UL, 235, 145

    statictext  #buy.StStyle  , "Style",  20, 175,  57,  20
    textbox     #buy.TbStyle  ,           10, 195, 100,  25
    Stylebits   #buy.TbStyle, _ES_CENTER OR _ES_UPPERCASE,0, 0, 0

    statictext  #buy.StStrike, "Strike", 150, 175,  34,  20
    textbox     #buy.TbStrike,           120, 195, 100,  25
    Stylebits   #buy.TbStrike, _ES_RIGHT, 0, 0, 0

    statictext  #buy.StExpDate, "Expire Date", 250, 175,  70,  20
    textbox     #buy.TbExpDate,                  230, 195, 100,  25
    Stylebits   #buy.TbExpDate, _ES_RIGHT, 0, 0, 0

    statictext  #buy.StType, "Type", 345, 175,  32,  20
    textbox     #buy.TbType,         340, 195,  50,  25
    Stylebits   #buy.TbType, _ES_CENTER OR _ES_UPPERCASE,0, 0, 0

    statictext  #buy.StSharesPerCon, "Shares/ Contract", 405, 175, 118,  20
    textbox     #buy.TbSharesPerCon,                  405, 195, 100,  25
    Stylebits   #buy.TbSharesPerCon, _ES_RIGHT, 0, 0, 0

    radiobutton #buy.RbBUY, "BUY", [CALCTOTAL], dummy,525,175,60,20
    radiobutton  #buy.RbSELL, "SELL", [CALCTOTAL],dummy,525,205,60,20

    statictext  #buy.StNumCont, "Num Contracts", 125, 220,  87,  20
    textbox     #buy.TbNumCont,                  120 ,240, 100,  25
    Stylebits   #buy.TbNumCont, _ES_NUMBER, 0, 0, 0
    Stylebits   #buy.TbNumCont, _ES_RIGHT, 0, 0, 0

    statictext  #buy.StOpenBro, "Brokerage", 243, 220,  87,  20
    textbox     #buy.TbOpenBro,                  230 ,240, 100,  25
    Stylebits   #buy.TbOpenBro, _ES_RIGHT, 0, 0, 0
    'Stylebits  #buy.TbOpenBro, _ES_NUMBER, 0, 0, 0

 statictext  #buy.StFees, "Fees", 350, 220,  87,  20
    textbox     #buy.TbOpenFee,   340 ,240, 50,  25
    Stylebits   #buy.TbOpenFee, _ES_RIGHT, 0, 0, 0
    'Stylebits  #buy.TbOpenFee, _ES_NUMBER, 0, 0, 0

    button      #buy.BtnCalc, " CALCULATE ", [CALCTOTAL], UL, 405, 240

    statictext  #buy.statictext51, "NOTES", 170, 280, 250,  40
    TexteditorColor$ = "white"
    texteditor  #buy.textedit42,  20, 320, 450, 200
    ComboboxColor$ = "white"

    statictext #buy.StOpenPrice, "Open Price",  20, 220,  67,  20
    textbox    #buy.TbOpenPrice,                10, 240, 100,  25
    Stylebits  #buy.TbOpenPrice, _ES_RIGHT, 0, 0, 0
    button     #buy.BtnStore, " RECORD ", [SAVERECORD], UL, 530, 240
    button     #buy.BtnChart, " CHART ", [DISPLAYCHART], UL, 620, 240

    statictext #buy.StTradeNum, "Trade Number", 520,  83,  128,  20
    textbox    #buy.TbNumber,                   660,  77,   80,  33

    stylebits  #buy.TbNumber,  0,_WS_BORDER, 0, _WS_EX_CLIENTEDGE
    Stylebits  #buy.TbNumber,    _ES_CENTER,0, 0, 0
    Stylebits  #buy.TbNumber,    _ES_READONLY, 0, 0, 0
    Stylebits  #buy.TbNumber,  0,_WS_TABSTOP, 0, 0

    statictext #buy.StMessage1, "DataBase Last Updated...",  20, 525,  265,  20
    textbox    #buy.TbGrossPrem,      620, 320, 100,  25
    statictext #buy.stGross, "Gross", 540, 320,  64,  20
    Stylebits  #buy.TbGrossPrem,_ES_RIGHT OR_ES_READONLY,0,0,0

    textbox    #buy.TbTotalBro,              620, 355, 100,  25
    statictext #buy.StBrokerage, "Brokerage",540, 355,  64,  20
    Stylebits  #buy.TbTotalBro,_ES_RIGHT OR_ES_READONLY,0,0,0

    textbox    #buy.TbOpenFees,     620, 385, 100,  25
    statictext #buy.StFees, "Fees", 540, 385,  31,  20
    Stylebits  #buy.TbOpenFees,_ES_RIGHT OR_ES_READONLY,0,0,0

    textbox    #buy.TbNetAmount      , 620, 415, 100,  25
    statictext #buy.NetAmount, "NET",  540, 415, 50,  20
    Stylebits  #buy.TbNetAmount,_ES_RIGHT OR_ES_READONLY,0,0,0

    graphicbox #buy.GbLine,            10,274, 775,  3

    '-----End GUI objects code

    '-----Begin menu code
    menu #buy, "Edit"  ' <-- Texteditor menu.
    menu #buy,  "&Tools","D_LoadMasterList",[DOWNLOADMATSERLIST],"UpDate Opt Data",[LOADDATA], "Delete Old Dates", [CLEANDB]
    '-----End menu code

    open "OPEN TRADE" for window as #buy
     #buy.BtnStore,"!disable"
     #buy.GbBanner, "down"
     #buy.GbBanner, "drawbmp BannerImage 0 0 ;flush"
     #buy.GbLine," down; fill darkgreen; flush"
     #buy.GbLine1," down; fill darkgreen; flush"
     #buy.GbLine3," down; fill darkgreen; flush"
     #buy, "font ms_sans_serif 10"
     #buy.statictext51, "!font Times_New_Roman Bold 20"
     #buy.RbBUY,"SET" : TransType$="B"
     #buy, "trapclose [quit.main]"

     #buy.StTradeNum, "!font Times_New_Roman Bold 15"
     #buy.TbNumber, "!font Times_New_Roman Bold 20";

[main.inputLoop]
 '   gosub [OPENDLL]
  '  gosub [OPENDB]
 '   gosub [LOADCONTROLFILE]
 '   gosub [SETVARIABLES]
 '   gosub [GETNEXTTRADENUMBER]
'    gosub [UPDATETRADENUMBER] 'need to move to after record save
  
'   gosub [LOADLASTUPDATE]
   #buy.StMessage1, "DataBase Last Updated..."+ LastUpdate$
  #buy.TbOptCode,"!Setfocus"
wait

[quit.main] 'End the program
    close #buy
   ' close #sq3
  '  unloadbmp("BannerImage")

END
 

Re: pressing ESC aborts the program
Post by Richard Russell on Sep 13th, 2016, 1:45pm

on Sep 13th, 2016, 1:25pm, metro wrote:
if you simply press "Esc" when the program opens it will immediately close

Because your window contains controls it's behaving like a dialog and Esc is being treated exactly like clicking on the Close button; you can confirm that by outputting a diagnostic message in the [quit.main] branch.

Since that is standard behavior for a Windows dialog box I'm rather surprised it's not what you want, but if it's essential that Esc doesn't act the same as Close you can test for it in the trapclose handler as follows:

Code:
[quit.main] 'End the program on Close, ignore Esc
    calldll #user32, "GetAsyncKeyState", _VK_ESCAPE as long, ret as short
    if ret < 0 then wait
    close #buy 

Because of the asynchronous nature of testing the key I can't guarantee that this will be 100% successful, but it seems to be pretty reliable here. Is it an acceptable workaround from your point of view?

Richard.

Re: pressing ESC aborts the program
Post by metro on Sep 13th, 2016, 2:06pm

Thanks Richard
The work around may be fine, I am showing my limited understanding here of window types.
How is it that clicking on either of the two combo boxes stops the window from acting as a dialog.
That is ESC no longer closes the program.
Re: pressing ESC aborts the program
Post by Jack Kelly on Sep 13th, 2016, 3:46pm

If you rem the line:

#buy.TbOptCode,"!Setfocus"

just before the 'wait' statement, then esc doesn't close the program, but I don't know why. I don't think any control is causing your 'window' to act like a 'dialog'.

Re: pressing ESC aborts the program
Post by Jack Kelly on Sep 13th, 2016, 4:04pm

If you run this minimal program, esc will quit.

Code:
NoMainWin
WindowWidth = 800 : WindowHeight = 600
textbox #win.textbox1, 260, 140, 100, 25
open "Esc Test" for window as #win
#win "TrapClose [quit]"
wait
[quit]
close #win
end
 


If a text box has focus then esc will quit. It doesn't seem right to me.
Re: pressing ESC aborts the program
Post by tsh73 on Sep 13th, 2016, 6:51pm

Quote:
that Esc is the standard keyboard shortcut for Cancel/Close in a Windows dialog box,


yes but why close window of type "window"?
Re: pressing ESC aborts the program
Post by metro on Sep 13th, 2016, 7:05pm

Quote:
yes but why close window of type "window"?

That was to be my next question
don't read anything into this other that whats being said (its not a criticism)
the same behaviour is not experienced in LB4.5


Re: pressing ESC aborts the program
Post by metro on Sep 13th, 2016, 11:27pm

Thanks for the reply Richard,
forget the compatibility issue I see this as a trap for new users, I see it as essential that any program written for LBB must set focus to any control other that a textbox for it to remain persistent on the screen for the end user.

Because as it stands now if I start a LBB program and press escape when it first loads up the program will terminate.

I just ran Jack Kelly's remember-it and pressed escape and it terminated.
I don't have any other main stream programs that I use behave that way, so QuickBooks Firefox ThunderBird and the list goes on, all must set focus to something other that a textbox when they first start.

I will now test a few more code snippets on this forum to see if it was just bad luck I chose Remember-it and we have the same issue.

I would be happy to accept loosing LB compatibility as there are many more features being built into your product, the speed and a single exe are appealing enough.

Re: pressing ESC aborts the program
Post by Jack Kelly on Sep 14th, 2016, 07:30am

Remember-It uses dialog windows exclusively, precisely so users CAN use the esc key to exit a window or close the program. I prefer that option to be available and for that reason use dialog windows as much as possible.

If quitting a program could have disastrous consequences for the user, the programmer should use a 'confirm' pop-up with the text "Quit? Are you sure??" or something to that effect.

I agree with Richard. This is a minor issue not worthy of any more attention.

Re: pressing ESC aborts the program
Post by tsh73 on Sep 14th, 2016, 07:38am

Quote:
and nobody has ever commented on it before.

Lol wink
So it's so rare occasion noone ever pressed ESC before (or never figured out what happened then they did - I'd probably not).
But now you have a few people thinking it wrong. Consider it a request?

As for me, I was really surprised then I found that ESC closes dialog window in JB/LB - I believe it is not written in a helpfile anythere.
So I probably filed it as a bug. But then I was told "But this is normal for dialog window" - ok I accept it. After all in my mind dialog window is short-lived, opened for specific task and closed with OK or Cancel. So ESC just doubles Cancel button, looks reasonable.

But if I want to use this functionality I would create window of type "Dialog", right?
Just as Jack just wrote: Quote:
and for that reason use dialog windows


But main program window silently closing on ESC - not the thing I ever wanted.
(besides it works different depending on control with focus. Textbox having focus closes on ESC, button or window - no)

Quote:
You make it sound as though it was a deliberate decision,
You really think too good of my English. It was just "why". You explained that "why" pretty comprehensive (I dunno - lack of word - but I understand what you mean), but I still think this behaviour better be changed if possible.
Re: pressing ESC aborts the program
Post by Richard Russell on Sep 14th, 2016, 08:17am

on Sep 14th, 2016, 07:38am, tsh73 wrote:
besides it works different depending on control with focus. Textbox having focus closes on ESC, button or window - no

You should ask Microsoft about that one! It's always been the case in Windows that if a key has a 'shortcut action' in a specific control, then that's what it does. If a different control has focus then that same key may do something completely different, including closing the entire window.

Take the simple case of the Tab key. Normally in a dialog box Tab moves focus from one control to another, but if the focus is currently on an edit control Tab does something entirely different. Users are expected to be aware of which control currently has the focus and understand that various keys will behave differently as a result.

Quote:
But now you have a few people thinking it wrong. Consider it a request?

As far as adding it to the 'wishlist' is concerned I'll do a deal with you! I have not the slightest idea how I would modify LBB to prevent Esc closing the window, because I don't know how it happens. If you can find out, and tell me, how the keypress gets 'propagated' from the child control to its parent - i.e. what message(s) are sent and when - then I'll consider making a change. OK?

Richard.

Re: pressing ESC aborts the program
Post by tsh73 on Sep 14th, 2016, 08:52am

Quote:
As far as adding it to the 'wishlist' is concerned I'll do a deal with you! I have not the slightest idea how I would modify LBB to prevent Esc closing the window, because I don't know how it happens. If you can find out, and tell me, how the keypress gets 'propagated' from the child control to its parent - i.e. what message(s) are sent and when - then I'll consider making a change. OK?

Fair enough. I have no idea either but some reading on Windows API would not make me any harm wink
Re: pressing ESC aborts the program
Post by metro on Sep 14th, 2016, 10:33am

Quote:
Remember-It uses dialog windows exclusively, precisely so users CAN use the esc key to exit a window or close the program. I prefer that option to be available and for that reason use dialog windows as much as possible.

my apology I should have checked that first

Well that was a rather robust debate, I will concede even if I had another life time I could not reach the level of expertise you all have.

I do find it bizarre that LB Booster and BBC Basic handle the Esc key in this manner. (read I have a limited understanding)

So today I tried FreeBasic , RealBasic and Free Pascal and they all perform the same as LB and JB, that said I can learn to live with the difference.

I will try Richards work around for now
Code:
[quit.main] 'End the program on Close, ignore Esc
    calldll #user32, "GetAsyncKeyState", _VK_ESCAPE as long, ret as short
    if ret < 0 then wait
    close #buy  


Quote:
I just don't get why you see 'closing on pressing Esc' as a "trap". Why is the 'new user' pressing the Esc key in the first place? People don't press keys at random just for the heck of it. grin


I know for a fact there is at least one user that will inadvertently press Esc twice when closing a Dialog, then what a shock your program has disappeared.
Re: pressing ESC aborts the program
Post by tsh73 on Sep 14th, 2016, 10:57am

I've just found an article
Disabling Escape in modal dialog boxes
Posted August 23rd, 2006 by William Willing

and it looks like it is edit control that behaves in strange ways.

If I create window with edit (:textbox) and a button, then then opened "for window" it closes on ESC only with focus on textbox
Then then opened "for dialog" it closes on ESC all the time.
(code adapted from a helpfile)
Code:
nomainwin
    'trapclose example using a branch label event handler
  statictext #example.label, "Now close the window!!", 10, 10, 200, 25
  textbox #example.txt, 10, 40, 200, 25
  button #example.txt, "open notice", [note], ul, 10, 100


'  open "Demonstrate trapclose" for window as #example
  open "Demonstrate trapclose" for dialog as #example
  print #example, "trapclose [branch]"
  wait

[branch]
  confirm "Really close?"; answer$
  if answer$ = "no" then wait
  close #example
  end

[note]
    notice "now close it with ESC"
    wait 

EDIT
I just tried to add all the controls - normal window closes only with focus on the textbox
Dialog window closes al focus everythere but edit (multiline) control.

So it likely not the thing described in that article.
Code:
nomainwin
    'trapclose example using a branch label event handler
  statictext #example.label, "Now close the window!!", 10, 10, 200, 25
  textbox #example.txt, 10, 40, 200, 25
  button #example.txt, "open notice", [note], ul, 10, 100
  CHECKBOX #example.ext, "label", setHandler, resetHandler, 250, 10, 100, 25
  COMBOBOX #example.ext, array$(), eventHandler, 250, 40, 100, 25
  LISTBOX #example.ext, array$(), eventHandler, 10, 150, 150, 100
  RADIOBUTTON #example.ext, "label", setHandler, resetHandler, 250, 100, 100, 25
  TEXTEDITOR #example.ext, 250, 200, 100, 100

WindowWidth = 450
	

  open "Demonstrate trapclose" for window as #example
'  open "Demonstrate trapclose" for dialog as #example
  print #example, "trapclose [branch]"
  wait

[branch]

 'End the program on Close, ignore Esc
'    calldll #user32, "GetAsyncKeyState", _VK_ESCAPE as long, ret as short
'    if ret < 0 then wait

    confirm "Really close?"; answer$
  if answer$ = "no" then wait
  close #example
  end

[note]
    notice "now close it with ESC"
    wait 

Re: pressing ESC aborts the program
Post by Richard Russell on Sep 14th, 2016, 11:49am

on Sep 14th, 2016, 10:57am, tsh73 wrote:
I've just found an article
Disabling Escape in modal dialog boxes
Posted August 23rd, 2006 by William Willing

That is indeed most interesting: not only does it answer my question about what message gets sent when Esc is pressed (WM_COMMAND + IDCANCEL), which is what I needed to know to be able to suppress the Esc action, but it also reveals that if there's a multiline Edit Control present any simple modification I might make won't work. What it gives with one hand it takes away with the other!

Richard.

Re: pressing ESC aborts the program
Post by Richard Russell on Sep 16th, 2016, 08:38am

on Sep 14th, 2016, 10:57am, tsh73 wrote:
it looks like it is edit control that behaves in strange ways.

Chasing this up, even Raymond Chen (author of the famous The Old New Thing blog) has commented on it as follows: "Yes, when you hit ESC in a multiline edit, it posts a WM_CLOSE to its parent in the mistaken belief that it is part of a dialog box.  This is for compatibility with Windows 2.0, which behaved this way.  It's annoying now, but compatibility means having to be bug-for-bug compatible with the previous version...".

This was written in 1999 and the fact that it appears to be still the same today, despite his admission that it does indeed qualify as a bug, means we're stuck with it - even though the argument that it is necessary for compatibility with Windows 2.0 is a bit weak now! Microsoft could easily have introduced a new style bit to disable this behavior, which wouldn't have compromised compatibility at all.

Let me know if my suggested workaround (testing in the trapclose handler for the Escape key being pressed) is effective. Clearly it can't be 100% reliable, because of the asynchronous nature of the test, but hopefully it will be good enough.

The only other way I can think of fixing it, other than by modifying LBB, would be to use WMLiberty to subclass the edit control, which is a heavyweight solution for a problem which I still think is relatively minor.

Richard.

Re: pressing ESC aborts the program
Post by tsh73 on Sep 16th, 2016, 09:28am

I would like to remind that problem occurs then single-line edit has focus in ordinary window.
So that problem with multiline edit likely different thing.

Yes I tried trapclose workaround and it worked all few times I tried.
Re: pressing ESC aborts the program
Post by Richard Russell on Sep 16th, 2016, 10:48am

on Sep 16th, 2016, 09:28am, tsh73 wrote:
I would like to remind that problem occurs then single-line edit has focus in ordinary window. So that problem with multiline edit likely different thing.

No, in both LB 4 and LBB a single-line TEXTBOX is a multiline edit control. You can confirm that using this code:

Code:
    textbox #w.tb, 10, 10, 200, 25
    open "Textbox style test" for window as #w
    htb = hwnd(#w.tb)
    calldll #user32, "GetWindowLongA", htb as ulong, _
      _GWL_STYLE as long, style as long
    print dechex$(style)
    wait 

You will see that in both LB 4 and LBB the following value is printed in the mainwin:

Style Code:
508100C4 

The 4 in the least-significant digit position indicates that it is a multiline edit control (ES_MULTILINE = 4), despite the fact that it has only one line!

It is clearly the case that the Edit Control bug (which I have now found many references to, including at the PowerBASIC forum) is the reason for the observed behavior.

Richard.
Re: pressing ESC aborts the program
Post by tsh73 on Sep 16th, 2016, 11:00am

Quote:
No, in both LB 4 and LBB a single-line TEXTBOX is a multiline edit control.

Err... I remember reading something about LB TEXTBOX allows multiline.
I did not expected single line control use "multiline edit control".

I wonder why LBB uses multiline edit for singleline TEXTBOX?
Re: pressing ESC aborts the program
Post by Richard Russell on Sep 16th, 2016, 11:47am

on Sep 16th, 2016, 10:48am, Richard Russell wrote:
No, in both LB 4 and LBB a single-line TEXTBOX is a multiline edit control.

Here's an even more direct demonstration. In the program below I explicitly create a single-line edit control by clearing the ES_MULTILINE bit using stylebits; in this case pressing Esc does not close the window:

Code:
    textbox #w.tb, 10, 10, 200, 25
    stylebits #w.tb, 0, _ES_MULTILINE, 0, 0
    open "Textbox style test" for window as #w
    wait 

Quote:
I wonder why LBB uses multiline edit for singleline TEXTBOX?

Because LB 4 does!! It's necessary for compatibility (there are LB programs which depend on it).

Richard.

Re: pressing ESC aborts the program
Post by metro on Sep 16th, 2016, 2:09pm

I have tinkered with two of my programs to get them to run in LBB both have Richards work around and am happy to say... "all good."

Each program is used daily and handle the many times I accidentally press ESC twice when closing a dialog to drop back to the main window.
Re: pressing ESC aborts the program
Post by tsh73 on Sep 19th, 2016, 07:52am

Hello Richard
If
Quote:
No, in both LB 4 and LBB a single-line TEXTBOX is a multiline edit control.


what is TEXTEDITOR control?

(after all, window closes only then focus is on TEXTBOX)
Re: pressing ESC aborts the program
Post by Richard Russell on Sep 19th, 2016, 1:50pm

on Sep 19th, 2016, 07:52am, tsh73 wrote:
what is TEXTEDITOR control?

That's an Edit Control too, but I'm not sure what the stylebits settings are offhand (I'm away from home at the moment).

Richard.

Re: pressing ESC aborts the program
Post by Richard Russell on Sep 19th, 2016, 6:45pm

on Sep 19th, 2016, 1:50pm, Richard Russell wrote:
That's an Edit Control too

I can confirm that it's a superclassed (not subclassed) multiline Edit Control. So it has a different class name (LBBEDIT) and extended functionality - which it needs for compatibility with LB's custom TEXTEDITOR control - but is based on a standard Edit Control.

Richard.