Home  |  Contents 
Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: MMBasic for DOS Beta 6 Post ReplyPost New Topic
<< Prev Page of 8
Message << Prev Topic | Next Topic >>

Joined: 28 July 2017
Location: Sweden
Online Status: Offline
Posts: 11
Posted: 20 September 2017 at 6:44am | IP Logged Quote Peter63

Hi Michael,

I wrote a function called "LineEdit".

This is a way to do it . I have a Sub i called sinput that
works like this .

This (sinput) Sub return exit keystoke


Back to Top View Peter63's Profile Search for other posts by Peter63

Joined: 02 June 2014
Location: Germany
Online Status: Offline
Posts: 490
Posted: 20 September 2017 at 10:38am | IP Logged Quote twofingers

Hi Peter,

this is excellent! Good job! Maybe something for the MMBasic Library?


Edited by twofingers on 20 September 2017 at 10:38am
Back to Top View twofingers's Profile Search for other posts by twofingers

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2117
Posted: 20 September 2017 at 1:09pm | IP Logged Quote Geoffg

Peter63 wrote:
Is sending in default-string to buffer before input a way?


No, all that would do is allow you to backspace over the string (not very useful) - plus it is not a good thing to complicate the language with extra speciality constructs like this when the same outcome can be achieved using ordinary BASIC programming.


Edited by Geoffg on 20 September 2017 at 1:21pm
Back to Top View Geoffg's Profile Search for other posts by Geoffg Visit Geoffg's Homepage

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 300
Posted: 20 September 2017 at 2:18pm | IP Logged Quote CaptainBoing

I have never met a Basic where you could provide a default string to the INPUT statement - happy to be shown otherwise but it defo isn't Microsoft standard from where MMBasic draws its inspiration (and a lot of look 'n' feel of the language).

Years ago (QB5 days) I had a function called EDIT$ that did very much the same as Michael's LineEdit above. INPUT never had the flexibility for really nice character screen handling... "Redo from start" and scrolling, limiting string length and the ? prompt etc.... EDIT$ allowed you to edit a string at a position on the screen with a maximum length etc.

Edited by CaptainBoing on 20 September 2017 at 2:42pm


all you need is duct tape and WD40 (if it moves and shouldn't, use duct tape; if it doesn't move and should, use WD40)
Back to Top View CaptainBoing's Profile Search for other posts by CaptainBoing

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 1141
Posted: 21 September 2017 at 6:49am | IP Logged Quote robert.rozee

the following comes close to what is being asked for:

Z$="default value"
  getstring("some string = ", Z$)
  Print "<" Z$ ">"
Loop Until Z$="quit"

Sub getstring(A$, B$)
  Print Chr$(13) A$ B$ Chr$(13) A$;
  Loop Until I=13 Or I=8
  If I=8 Then
    For J=1 To Len(B$): Print " ";:Next J
    For J=1 To Len(B$): Print Chr$(8);:Next J
    Input "", B$
End Sub

you have the choice of pressing the enter key to accept the current default value, or press the backspace key and entering a new value. in order to get away without needing to press the backspace key, there would need to be some way of peeking into the keyboard input buffer without removing the next character from it. but pressing backspace first is really a pretty minor 'cosmetic' issue.

rob :-)
Back to Top View robert.rozee's Profile Search for other posts by robert.rozee

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Search the forums using Google.
<< Prev Page of 8
In the news...
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.0781 seconds.
Privacy Policy     Process times : 0, 0, 0, 0.08