LB Booster
« Handle variables in maphandle »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:29am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Handle variables in maphandle  (Read 118 times)
k6dgw
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 6
xx Handle variables in maphandle
« Thread started on: Mar 6th, 2018, 10:47pm »

Are handle variables valid in maphandle?

textbox #X.tmp, x, y, w, h
newh$="#Win.rc"+str$(row)+str$(col)
maphandle #X.tmp #newh$

gives me a type mismatch on the maphandle line

Fred
User IP Logged

Fred
Sparks NV USA
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Handle variables in maphandle
« Reply #1 on: Mar 7th, 2018, 08:33am »

on Mar 6th, 2018, 10:47pm, k6dgw wrote:
Are handle variables valid in maphandle?

Of course; in fact MAPHANDLE would hardly be useful at all if that wasn't the case. The error in your code is that you have a spurious hash symbol prefixing the second parameter; it should be:

Code:
    textbox #X.tmp, x, y, w, h
    newh$="#Win.rc"+str$(row)+str$(col)
    maphandle #X.tmp, newh$ 

The two forms of MAPHANDLE are:

Code:
    MAPHANDLE #oldhandle, #newhandle
    MAPHANDLE #oldhandle, newhandle$ 

Richard.
User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Handle variables in maphandle
« Reply #2 on: Mar 7th, 2018, 12:02pm »

Fred is thinking about the #handleVariable concept.

Code:
nomainwin

textbox #t.txt, 20, 40, 260, 25
WindowWidth = 350 : WindowHeight = 190
open "Simple text box" for window as #t
#t "trapclose [quit]"

h$="#t.txt"
#h$ "hello"

new$="#t.txt2"
maphandle #t.txt, #new$ 

#new$ "again"
wait

[quit]
close #t
end 
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Handle variables in maphandle
« Reply #3 on: Mar 7th, 2018, 12:49pm »

on Mar 7th, 2018, 12:02pm, Rod wrote:
Fred is thinking about the #handleVariable concept.

It's true that LB is somewhat inconsistent in its handle variable syntax, which is probably what led him astray. When you are accessing a control using a handle variable you must add a hash prefix:

Code:
    #handlevariable$ "Command string" 

(this means you effectively have two hashes: an explicit one as shown and another in the handle variable string).

However in the MAPHANDLE statement you must not add a hash prefix to the handle variable:

Code:
    MAPHANDLE #oldhandle, newhandle$ 

Although this is clearly documented in the LB help file, the inconsistency could usefully be highlighted to reduce the likelihood of mistakes.

Richard.
User IP Logged

k6dgw
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 6
xx Re: Handle variables in maphandle
« Reply #4 on: Mar 12th, 2018, 9:58pm »

Thank you both! It's always the little things that confuse me. smiley
User IP Logged

Fred
Sparks NV USA
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