BBC BASIC for Windows
« Windows Text box (dissection for understanding) »

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



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: Windows Text box (dissection for understanding)  (Read 477 times)
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
cheesy Windows Text box (dissection for understanding)
« Thread started on: Apr 4th, 2016, 11:34pm »

I think this is going to work well.

I had to make REM statements all over the original sample program to get this far and then I modified the text input and window..
Also I modified the text input to have a user sample code supplied..
So the program can supply the text box with a message and this will work nicely
But
1) I need to have at least 3 lines of information showing at a time for my tool and it must scroll like in a normal editor
2) Each line must be its own string (like in a IDE)
3) I must be able to insert a new string in the editor at the active line ( for POV draw to code insertion)
4) I must be able to place this input control anywhere and it must not interfere with main window function
( I could use mouse click to edit it, but it would be nice to just type and press enter to give my game a command)

( remember the good old days in gaming?)
"open box"
"The box is empty"
"kill dragon"
"Its too big and devours you"
"game over"
Code:
     
 REM. Program to demonstrate a Dialogue Box
      INSTALL @lib$+"WINLIB2"

      BS_DEFPUSHBUTTON = &1
      CB_ADDSTRING = &143
      CB_SETCURSEL = &14E
      CBS_DROPDOWNLIST = &3
      ES_AUTOHSCROLL = &80
      ES_NUMBER = &2000
      LB_ADDSTRING = &180
      LB_GETCURSEL = &188
      UDM_SETRANGE = &465
      UDS_ALIGNRIGHT = &4
      UDS_AUTOBUDDY = &10
      UDS_SETBUDDYINT = &2
      WS_CHILD = &40000000
      WS_GROUP = &20000
      WS_VISIBLE = &10000000
      ES_MULTILINE = 500
      REM  dlg%=FN_newdialog("", 20, 20, 160, 128, 8, 560)
      dlg%=FN_newdialog("", 20, 20, 800, 50, 8, 560)
      activemessage$="FOR X = 1 TO 1000"
      REM PROC_editbox(dlg%, activemessage$, 101, 1, 20, 104, 12, ES_AUTOHSCROLL)
      REM *******************************x, y,  h  ,v  ,  ?, autoscroll is self explained.
      PROC_editbox(dlg%, activemessage$, 101, 1, 1, 700, 12, ES_AUTOHSCROLL)
      PROC_showdialog(dlg%)
      ON CLOSE PROC_closedialog(dlg%):QUIT
      ON ERROR PROC_closedialog(dlg%):PRINT'REPORT$:END
      Click%=0
      ON SYS Click% = @wparam% : RETURN
      REPEAT
        WAIT 1
        click%=0
        SWAP Click%, click%
      UNTIL click%=1 OR click%=2 OR !dlg%=0

      IF click%=1 THEN
        PRINT "OK pressed, settings were:"'
  
        DIM text% 255
        SYS "GetDlgItemText", !dlg%, 101, text%, 255
        PRINT "Text box contained """$$text%""""
  
      ELSE
        PRINT "Program exited"
      ENDIF

      PROC_closedialog(dlg%)
      END
 
« Last Edit: Apr 4th, 2016, 11:57pm by michael » User IP Logged

I like making program generators and like reinventing the wheel
Zaphod
Guest
cheesy Re: Windows Text box (dissection for understanding
« Reply #1 on: Apr 4th, 2016, 11:55pm »

Just to mention that in BB4W, unlike LB, it is designed so that can put things in the main window, and probably would. So you need to look at WINLIB5. Indeed LBB editor is actually run as two RichEdit Controls in the Main window.
Code:
H2%=FN_createwindow("RichEdit20W", "", 0, T1%, @vdu%!208, @vdu%!212-T1%-y%, 0, &B00044, 0)
I2%=FN_createwindow("RichEdit20A", "", @vdu%!208/2, T1%, @vdu%!208/2, @vdu%!212-T1%-y%, 0, &10B00804, 0) 
User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
cheesy Re: Windows Text box (dissection for understanding
« Reply #2 on: Apr 5th, 2016, 12:08am »

Even in LB I didn't learn to do this. Its the same story concerning APIs.. I always avoided them. (mostly)

Mainly because I am always looking for simple one line commands that allow me to have complete control of the entire function within the command.

I really am trying to break this bad habit, because I avoid many beneficial things by reinventing things..
It would be good for me to learn how to break it down into small functional snippets for people who are new to programming.
( newer than me. and I know there are people like that who would come here..)
I am a beginner in BBC Basic, but there are people who really have no programming experience at all that would need really simple examples that do ONE function at a time.
The examples provided don't all have that kind of break down. Its normally many functions in one.
The sample file list would be HUGE if they did that.

But the sample I got this from was easy enough that I could extract this.

With your help I can help make that list.
« Last Edit: Apr 5th, 2016, 12:26am by michael » User IP Logged

I like making program generators and like reinventing the wheel
Zaphod
Guest
cheesy Re: Windows Text box (dissection for understanding
« Reply #3 on: Apr 5th, 2016, 12:39am »

There are lots of programs in the Yahoo group files

https://groups.yahoo.com/neo/groups/bb4w/files

Richard has recently closed that again for messages, as he does from time to time when he gets annoyed with people or yahoo, but the files remain open to members. There are some gems and a lot of other stuff there, but plenty to learn from. There are some great program listings on Richard's web site. I am not sure what you expected to find. Programming for windows without using the Windows API is what the libraries are for.
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