Liberty BASIC Community Forum
« Search Results »

Welcome Guest. Please Login or Register.
Sep 2nd, 2014, 9:03pm


Rules|Home|Help|Search|Recent Posts|Notification

--Liberty BASIC Resources--
Yahoo Code Repository (source must be included)
Liberty BASIC Community WikiSpace
Liberty Labs
Bay Six Software Forum
Liberty BASIC Home Page

Official Liberty BASIC Support
Liberty BASIC Programmer's Encyclopedia
Liberty BASIC 5 Handbook
Liberty BASIC on Rosetta Code

Search Results

Total results: 10


 1   Novice / Re: Using the run command question  on: Yesterday at 1:47pm
Started by TexasPete | Post by Rod
Also Alyce posted this advice some time ago.

Quote:
Just a hint for those who like to open the default browser.

It has been found that due to misconfiguration of some systems even calling Explorer is not always launching the viewer associated to HTML files.

The one command, which has been proven to always succeed is this Code:
run "rundll32.exe url.dll,FileProtocolHandler "; chr$(34); FileName$; chr$(34)

 
  Reply Quote Notify of replies

 2   Novice / Re: Using the run command question  on: Yesterday at 10:32am
Started by TexasPete | Post by Rod
I think you just need to preserve the space after explorer. The command line needs to look just like it would if you had typed it yourself and of course you leave a space between the command explorer and its arguments.

this fails
RUN "explorer" +chr$(34)+"c:\atemp\my.html"+chr$(34),SHOWNORMAL

this works
RUN "explorer " +chr$(34)+"c:\atemp\my.html"+chr$(34),SHOWNORMAL




 
  Reply Quote Notify of replies

 3   Novice / Using the run command question  on: Yesterday at 08:28am
Started by TexasPete | Post by TexasPete
Below is a run command to run explorer and a a text file in it.
What would be the format for running an html file with out specifiing the browser to be used. Is it possible?


run "explorer " + chr$(34) + DefaultDir$ + "\myfile.txt" + chr$(34)

Maybe it is something like this:
RUN "explorer" +chr$(34)+"HelpHtml\ChickenLittleHelp.html"+chr$(34),SHOWNORMAL


The above did not work.


Texas Pete
 
  Reply Quote Notify of replies

 4   Game and Graphic Programming / Re: Changing Two Background Colors on the Fly ...  on: Aug 31st, 2014, 2:22pm
Started by SgrB2 | Post by tenochtitlanuk
Although the code as supplied works in LB, it should not!
Add a 'down' command as shown below ( it was missing in the version I supplied). Program works as before but won't lead you to expect drawing to work always without it!!
Code:
#win.graphics "down ; backcolor 180 180 60 ; boxfilled 800 600" 

 
  Reply Quote Notify of replies

 5   General Board / Re: Running out of memory  on: Aug 30th, 2014, 09:43am
Started by Roger Thomas | Post by Roger Thomas
I do flush graphics but I use delsegment to release them. Its my Mp3 player I'm working on. By itself it seems to handle memory good.
I'll go back through it and see if I am overlooking something.
I may not be closing something when exiting the program.

Thanks.
 
  Reply Quote Notify of replies

 6   General Board / Re: Running out of memory  on: Aug 30th, 2014, 02:11am
Started by Roger Thomas | Post by Rod
The most common reason for running out of memory is flushing graphics. This creates hidden segments. Arrays also use memory but this is easily recovered. So are you flushing graphics? Deleting the graphic resource does not delete the segment this is a copy, so you need to be deleting unwanted segments all the time.

http://lbpe.wikispaces.com/Graphic+Segments

Also review alyce's graphic segment article.

 
  Reply Quote Notify of replies

 7   General Board / Running out of memory  on: Aug 29th, 2014, 9:34pm
Started by Roger Thomas | Post by Roger Thomas
I keep running out of memory in Liberty Basic.
I know there's a memory limit in Liberty.
I can test my program about 10 times and then I have to restart Liberty Basic because it runs out of memory.
I can test my program about 10 more times and then have to restart again.
My program runs good when I build it and run it.

The memory usage for liberty starts off about 12mb and keeps raising every time I test my program until it gets to about 60mb and either locks up says out of memory.

As far as I can tell I am releasing the memory my program uses.
Does anyone else have this problem? Any suggestions?

Thanks
 
  Reply Quote Notify of replies

 8   Liberty BASIC Code / Re: ButtonUp in debug mode  on: Aug 28th, 2014, 1:37pm
Started by rodsweb | Post by Rod
Isn't that the point? Unhandled events will stack, in my scenario the computer will be streets ahead of the finger and there will be no queue. In yours there might be a thousand events queued to action.


 
  Reply Quote Notify of replies

 9   Liberty BASIC Code / Re: ButtonUp in debug mode  on: Aug 28th, 2014, 09:55am
Started by rodsweb | Post by rodsweb
OK thanks.
Is there a chance that second time around when buttonDown is processed, if the routine is extensive, the buttonMove and buttonUp could be missed since we haven't got to the new print to turn them on?
 
  Reply Quote Notify of replies

 10   Liberty BASIC Code / Re: ButtonUp in debug mode  on: Aug 28th, 2014, 09:10am
Started by rodsweb | Post by Rod
Not sure I am addressing the original problem but by precise sequence I mean to turn on and turn off events as they are needed. In a larger program this is perhaps safer as outstanding or forgotten events can take you to unexpected places.

This is a section of code from the wiki tutorial on "when events". I have amended it to stop and start events as needed during the process.

So button down is the only event enabled at the start, once this fires the mouse move and button up events are enabled and the button down event is turned off. At the end the mouse move and button up events are stopped and the button down event re enabled.

Its just the concept of managing events on and off I am trying to get across.

Code:
'
    '   Demo demonstrating
    '       When leftButtonDown
    '       When leftButtonMove
    '       When leftButtonUp
    '       MouseX
    '       MouseY

    WindowWidth = 407
    WindowHeight = 350

    UpperLeftX = Int((DisplayWidth - WindowWidth)/2)
    UpperLeftY = Int((DisplayHeight - WindowHeight)/2)

    '   Define a Menu
    Menu #main, "&Options", "E&xit", [EndDemo]
    '   Define a Graphicbox
    Graphicbox #main.g, 0, 0, 400, 300
    '   Open the Window
    Open "The Mouse When Commands" for Window as #main
    '   Add the Trapclose statement to properly end the program
    Print #main, "Trapclose [EndDemo]"
    '   Add the When leftButton commands
    Print #main.g, "When leftButtonDown [ButtonLeftDown]"
    Print #main.g, "When leftButtonMove [ButtonLeftMove]"
    Print #main.g, "When leftButtonUp [ButtonLeftUp]"

    '   Place the pen in the Down position
    Print #main.g, "Down"
    '   Fill the graphicbox with Yellow
    Print #main.g, "Fill Yellow"
    '   Assign the pen color as Black
    Print #main.g, "Color Black"
    '   Assign the backcolor as Yellow
    Print #main.g, "Backcolor Yellow"
    '   Assign a position
    Print #main.g, "Place 100 50"
    '   Write the directions
    Print #main.g, "\\Left Button Down - Start Circle"
    Print #main.g, "\\Left Button Move - Drag Circle"
    Print #main.g, "\\Left Button Up - Place Circle"
    Wait

[EndDemo]
    Close #main
    End

[ButtonLeftDown]
    '   Obtain mouse x, y positions with the special
    '   variables MouseX and MouseY
    '   Note that MouseX and MouseY are CASE SENSITIVE
    '   mousex, mouseY, etc. will not work
    xOld = MouseX
    yOld = MouseY
    '   Clear the graphicbox and clear memory
    Print #main.g, "Cls"
    '   Fill the graphicbox with the color Yellow
    Print #main.g, "Fill Yellow"
    '   Assign the pen color as Darkblue
    Print #main.g, "Color Darkblue"
    '   Assign the backcolor as Darkblue
    Print #main.g, "Backcolor Darkblue"
    '   Place the pen at the mouse click position
    Print #main.g, "Place ";xOld;" ";yOld
    '   Draw a filled circle
    Print #main.g, "Circlefilled 20"
    '   Don't preserve the graphic
    Print #main.g, "Discard"


    '   Await the user's next move
    'stop the buttondown event
    Print #main.g, "When leftButtonDown"
    'start looking for the mousemove event and button up event
    Print #main.g, "When leftButtonMove [ButtonLeftMove]"
    Print #main.g, "When leftButtonUp [ButtonLeftUp]"
    Wait

[ButtonLeftMove]
    '   Obtain mouse x, y positions with the special
    '   variables MouseX and MouseY
    '   Note that MouseX and MouseY are CASE SENSITIVE
    '   mousex, mouseY, etc. will not work
    xNew = MouseX
    yNew = MouseY
    '   Erase the previous circle by drawing in background color
    '   Assign the pen color as Yellow
    Print #main.g, "Color Yellow"
    '   Assign the backcolor as Yellow
    Print #main.g, "Backcolor Yellow"
    '   Place the pen at the old mouse position
    Print #main.g, "Place ";xOld;" ";yOld
    '   Draw a filled circle
    Print #main.g, "Circlefilled 20"
    '   Draw the new circle by in Darkblue
    '   Assign the pen color as Darkblue
    Print #main.g, "Color Darkblue"
    '   Assign the backcolor as Darkblue
    Print #main.g, "Backcolor Darkblue"
    '   Place the pen at the new mouse position
    Print #main.g, "Place ";xNew;" ";yNew
    '   Draw a filled circle
    Print #main.g, "Circlefilled 20"
    '   Don't preserve the graphics
    Print #main.g, "Discard"
    '   Await the user's next move
    '   Make the new x and new y the old x and old y
    xOld = xNew
    yOld = yNew
    Wait

[ButtonLeftUp]
    '   Obtain mouse x, y positions with the special
    '   variables MouseX and MouseY
    '   Note that MouseX and MouseY are CASE SENSITIVE
    '   mousex, mouseY, etc. will not work
    xFinal = MouseX
    yFinal = MouseY
    '   Clear the graphicbox and clear memory
'    Print #main.g, "Cls"
    '   Fill the graphicbox with the color Yellow
'    Print #main.g, "Fill Yellow"
    '   Assign the pen color as Darkblue
    Print #main.g, "Color Darkblue"
    '   Assign the backcolor as Darkblue
    Print #main.g, "Backcolor Darkblue"
    '   Place the pen at the mouse click position
    Print #main.g, "Place ";xFinal;" ";yFinal
    '   Draw a filled circle
    Print #main.g, "Circlefilled 20"
    '   Assign the pen color as Black
    Print #main.g, "Color Black"
    '   Assign the backcolor as Yellow
    Print #main.g, "Backcolor Yellow"
    '   Assign a position
    Print #main.g, "Place 100 50"
    '   Write the directions
    Print #main.g, "\\Left Button Down - Start Circle"
    Print #main.g, "\\Left Button Move - Drag Circle"
    Print #main.g, "\\Left Button Up - Place Circle"
    '   Preserve the graphics
    Print #main.g, "Flush"


    '   Await the user's next move
    'start looking for the button down event
    Print #main.g, "When leftButtonDown [ButtonLeftDown]"
    'stop the mousemove and button up events
    Print #main.g, "When leftButtonMove"
    Print #main.g, "When leftButtonUp"
    Wait

 

 
  Reply Quote Notify of replies


Rules|Home|Help|Search|Recent Posts|Notification



Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls