BBC BASIC for Windows
« Windows text input (complete control)+Graphics »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:52pm



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 input (complete control)+Graphics  (Read 572 times)
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
cheesy Windows text input (complete control)+Graphics
« Thread started on: Apr 5th, 2016, 02:19am »

NOTE: This post has been changed: THIS IS STAGE 1

- I am actually not happy with the way the windows interface works, mainly because there is so many unknowns and I don't like the text interface.. ( its so retro)

ALSO: there is posts bellow this one that show the next stages of development.. so you will need to try each example to see how I advance in this project
( and perhaps, find ways to make it help you )

1) it now allows complete control of the text box in a PROC
(for beginners PROCcycleinput(activemessage$) is the box control command)

2) activemessage$ can be changed to a different string

3) in this case, what you type or leave in the text box is repeated on the top of the screen in graphics text

4) all the elements are present to keep the input control active in a nice DEF PROCcycleinput(activemessage$)

The text editor box with scrolling interface was a problem because I require the input to be immediate and so I can only work with one line at a time.
I can make this work once I create a couple output only boxes for my 2 lines that I might scroll to or preview as I am editing..
I need 1 active line and 2 preview lines.. (1 before and one after the input line)

It may seem like this program is in the wrong place, but by the time I am done.. It will have more to do with graphics that it does with windows controls.
But there will be lots of windows controls too.

I am posting this in stages so that it is simple for new programmers..

If there is anything I can cut out of this program that isn't needed, please let me know.
( this is needed because I need to make a module for people that shows ONLY what makes this tool work,

BUT keep it mind that the variables bellow are most likely telling the Library what values to set.. ( I figured that much when I saw _ in the variable descriptions)
INTRESTING OBSERVATION:
The variable text% is being defined as a string and its new name is $$text% and you can use that as your string

(look in the program where I repeat this statement)
Code:
   
   REM. Program to demonstrate control tactics with editbox
      REM lets do this one snippet at a time
      INSTALL @lib$+"WINLIB2"
      MODE 22
      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
      firsttimeuse$="yes"
      PRINT "Type quit to end program"
      REPEAT
        IF firsttimeuse$="no" THEN activemessage$=$$text%
        IF firsttimeuse$="yes" THEN firsttimeuse$="no": activemessage$="FOR X = 1 TO 1000:REM I plan to keep telling you this"
        REM this is where your program would look for input and respond. But it initially needs to look for first time use
        PROCcycleinput(activemessage$)
      UNTIL $$text%="quit"
      IF click%=1 THEN PRINT "PROGRAM ENDED:"'
      PROC_closedialog(dlg%)
      END
      DEF PROCcycleinput(whatstring$)
      REM ***********namedialog,x,y,amountwide,amountdown  (others I dont know yet)
      dlg%=FN_newdialog("", 10, 380, 660, 30, 8, 560)
      WS_BORDER = &800000
      dlg%!16 AND= NOT WS_BORDER

      REM *Text box control***************x, y,  h  ,v
      PROC_editbox(dlg%, activemessage$, 101, 0, 10, 600, 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
      DIM text% 255
      SYS "GetDlgItemText", !dlg%, 101, text%, 255
      REM isn't this interesting?  the variable text% is being defined as a string and its new name is $$text% and you can use that as your string
      PRINT "Text box contained """$$text%""""
      ENDPROC
 
« Last Edit: Apr 10th, 2016, 01:28am by michael » User IP Logged

I like making program generators and like reinventing the wheel
hellomike
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 46
cheesy Re: Windows custom text box with graphics screen
« Reply #1 on: Apr 5th, 2016, 08:41am »

Michael,

Since you ask for it, yes, I think you can cut a lot from the program.

You say Quote:
so that it is simple for new programmers..

So if you really intend your post(s) to be educational for new programmers, programs should be to the point.

For example, is another MODE than the default one needed to illustrate how to use a Windows Text Box? No, it isn't, so leave the line "MODE 22" out for the time being.

Also all the unused Windows Constants are highly confusing and might even frighten fresh programmers. You only seem to need WS_BORDER and ES_AUTOHSCROLL, remove the others.

Then for:
Code:
PRINT "OK pressed, settings were:"' 


I don't see any OK (button) when I run the program. Change it to something more appropriate.

Finally:
Code:
      ELSE
        PRINT "Program exited" 


Remove the ELSE bit and move the PRINT after the ENDIF, because when I run and press Enter on the keyboard, did the program not exit as well?

Above tips might feel like unimportant but I can assure you that unlogic code or too much code can put new programmers off and that's what we want to avoid, don't we?

Well, again, you asked for feedback so please let me know if you appreciate this or if I should keep my mouth shut in the future. :)

Regards,

Mike
User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
cheesy Re: Windows text input (complete control)+Graphics
« Reply #2 on: Apr 5th, 2016, 10:32am »

Hi Hellomike,
The graphics are needed for this application. Otherwise I would need to put this post in a windows related board..

(I could do that, but it would create a conflict later as the project grew into what it will be.)


STAGE 2:
1) The top text output section is created
2) The user input is positioned
3) The bottom output section is created
Code:
      
REM. Program to demonstrate control tactics with editbox
      REM lets do this one snippet at a time
      INSTALL @lib$+"WINLIB2"
      MODE 22
      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
      firsttimeuse$="yes"
      PRINT "Type quit to end program"
      REPEAT
        IF firsttimeuse$="no" THEN activemessage$=$$text%
        IF firsttimeuse$="yes" THEN firsttimeuse$="no": activemessage$="FOR X = 1 TO 1000:REM I plan to keep telling you this"
        REM this is where your program would look for input and respond. But it initially needs to look for first time use
        PROCcycleinput(activemessage$)
      UNTIL $$text%="quit"
      IF click%=1 THEN PRINT "PROGRAM ENDED:"'
      PROC_closedialog(dlg%)
      END
      DEF PROCcycleinput(whatstring$)
      REM ***********namedialog,x,y,amountwide,amountdown  (others I dont know yet)
      dlg%=FN_newdialog("", 10, 380, 660, 60, 8, 560)
      WS_BORDER = &800000
      dlg%!16 AND= NOT WS_BORDER
      REM  PROC_static(dlg%,text$,id%,x%,y%,cx%,cy%,style%)   'technically this is in the wrong spot.(this is at the bottom of the box) OH WELL
      REM id% variable string is 103.. if you made it 101, then the return string would look for it..
      PROC_static(dlg%,"THIS AREA HOLDS MY NEXT LINE OF DATA",103,0,35,600,12,0)
      REM *Text box control************inputid,x, y,  h  ,v
      PROC_editbox(dlg%, activemessage$, 101, 0, 20, 600, 12, ES_AUTOHSCROLL)
      REM  PROC_static(dlg%,text$,id%,x%,y%,cx%,cy%,style%)    'technically this is in the wrong spot.(this is at the top of the box) OH WELL
      PROC_static(dlg%,"THIS AREA HOLDS MY PEVIOUS LINE OF DATA",102,0,10,600,12,0)
      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
      DIM text% 255
      SYS "GetDlgItemText", !dlg%, 101, text%, 255
      PRINT "Text box contained """$$text%""""
      ENDPROC
 
« Last Edit: Apr 5th, 2016, 1:21pm by michael » User IP Logged

I like making program generators and like reinventing the wheel
Zaphod
Guest
cheesy Re: Windows text input (complete control)+Graphics
« Reply #3 on: Apr 5th, 2016, 3:28pm »

Quote:
The variable text% is being defined as a string and its new name is $$text% and you can use that as your string


You fundamentally misunderstand that $$ is an operator.
A search for "$$" in the help file will tell you what is really going on.

The variable text% is never a string. The % tells you is is an integer. It might contain the address of a the start of a string or any thing else that is expressed as an integer.

The same applies to much of the code. You are grabbing code examples and modifying them and commenting without understanding what they are doing and why.
Coding is not an experimental science. Luckily, BB4W behaves in a very predictable way, but you do have to learn the rules by reading the manual and, hopefully, understanding it. The second part is often the difficult part for beginners which is where code examples help. But you are going to have to back up a bit and get it right if you are to help others.
Flawed examples would confuse me if I were starting out with BB4W. I started in BB4W by looking closely at the provided examples and Richard's code offerings, which, while terse, and lacking in comments sometimes, are very precise and thoughtful. Then I wrote simple examples to prove I understood a concept. I still do that when venturing into a new area.
I cannot recommend that beginners look at your code for guidance in its current state.
Am I now a reactionary old fart? Maybe.
User IP Logged

hellomike
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 46
cheesy Re: Windows text input (complete control)+Graphics
« Reply #4 on: Apr 5th, 2016, 6:35pm »

Michael,

I pretty much agree with all of Zaphod remarks.
By no means I'm trying to attack you because we all know that, when programming, it can be rather complicated so all the help is welcome.

If you are just posting snippets code belonging to a larger (future) project, then why ask for feedback because your reader can't know in what context the specific snippet is or will be used.

Snippets of code without the context will help no-one and might, in my opinion, even scare ace programmers off.

Can you explain us why you post what you post? Is it for educational purpose for other people or are you asking the BB4W community for help, i.e. for your own education?

I'm curious.
Thanks

Mike
User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
cheesy Re: Windows text input (complete control)+Graphics
« Reply #5 on: Apr 5th, 2016, 9:55pm »

Quote:
If you are just posting snippets code belonging to a larger (future) project, then why ask for feedback because your reader can't know in what context the specific snippet is or will be used.

Snippets of code without the context will help no-one and might, in my opinion, even scare ace programmers off.

Can you explain us why you post what you post? Is it for educational purpose for other people or are you asking the BB4W community for help, i.e. for your own education?


Hello mike
I did talk to Richard before I started to sample from supplied programs in the BBC Basic and asked if it was ok to use portions of them to gain understanding..

Richard said it would be ok. And he has provided me tonnes of help.

The purpose of my posts is to share ideas and connect with others. Hoping that lots of activity would attract people. ( lots of visitors, yes)
BUT
Hello mike
I return a question back to you.

Why do you not post content here and help me? You could provide those ultra simple proper coded programs that I cant?

Oh and, I think the majority of the ACE programmers left a long time ago. There is maybe 2 left? 1 moderator and one other skilled hobby programmer?

And I would say.. A beginner doesn't start at the top.. But that doesn't mean they cant try !



« Last Edit: Apr 6th, 2016, 12:15am by michael » User IP Logged

I like making program generators and like reinventing the wheel
Zaphod
Guest
cheesy Re: Windows text input (complete control)+Graphics
« Reply #6 on: Apr 6th, 2016, 2:08pm »

I don't think that is fair to put the onus on others. There is plenty of material for beginners.
Richard's site contains and links to a great deal that would take you through much of what you would need for normal Windows programming. There are quite a few graphics and games, some of which are quite excellent.

Your point about people drifting away from BB4W is right though. There are two groups, the old people, like myself, who knew BBC BASIC when it was on the BBC Computer. This group is becoming feeble minded, cantankerous and dying off. I am somewhere in there.
The people who come to BBC BASIC later tended to use it as a stepping stone to other more modern languages as they progress. Some of them have left some great stuff but unfortunately some of their archives have also been lost.
And then to add to that there is the fragmentation of the community from the starting and dropping of forum venues by Richard.
BBC BASIC on Yahoo, BB4W on Yahoo, Conforums (here), Wiggio, and now a new BBCBASIC Conforums which is active today. See a pattern here? And even on these there were periods when he would not respond and then belittle people who did. I am certain that was not his intention, let me make that clear. He is a great programmer but leading a community of followers could have been done a great deal better.

There are quite a few good programmers that lurk around here, the ones with thicker skins, but many of the past contributor have moved on. Other may just monitor the old sites or who knows?

I am certainly prepared to share my knowledge. I have written and posted materials for beginners especially the Windows API on other groups, but since this forum does not have a file archive it is best only for chat and question and answer not program examples or lengthy articles. They would be hard to find again. I understand that the Wiggio group has file archives, but I did not join there. The Original BB4W, yahoo group does have lots of stuff going back about 12 years. Plenty to be going on with.

So I am signing off this thread having had my say and before I upset more people.
User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
cheesy Re: Windows text input (complete control)+Graphics
« Reply #7 on: Apr 6th, 2016, 2:48pm »

I understand.

Richard said in the last message he sent, that he doesn't support lazy programming.

So he has high standards.

I respect that.

The idea of programming being like a game is irrelevant.
He stated he is a professional. Its that plain and simple..

I respect that also.

So if I post, it will only be for questions concerning a hard thing I cant figure out after long study.
I appreciate your help.

Regards,

Michael.
User IP Logged

I like making program generators and like reinventing the wheel
hellomike
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 46
cheesy Re: Windows text input (complete control)+Graphics
« Reply #8 on: Apr 6th, 2016, 7:22pm »

Thanks for the reply Michael.

Again, I was confused but it makes more sense now.

With your posts you mostly seek for advise and feedback so you know if you're approaching an issue the best way.

Fair enough and that's of course the power of groups like this.
Quote:
You could provide those ultra simple proper coded programs that I cant?

No guarantee but I will do my best.

Actually I think I already tried on April 3rd with a reply in your thread http://bb4w.conforums.com/index.cgi?board=support&action=display&num=1459164347 about what you can do to simplify and speed up PROC_comparray().

Compare the code from your PROC_comparray() procedure with that of ZAPHODS FNcomparray() function and my FNcomparrayNEW() function. Is this the kind of feedback you could use?

Let me know.

Mike
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