Author |
Topic: type mismatch on stylebits (Read 719 times) |
|
Alincon
Full Member
member is offline
Posts: 147
|
|
type mismatch on stylebits
« Thread started on: Feb 3rd, 2015, 12:37am » |
|
In LBB I get the message "type mismatch on this stylebits command. In LB4 it works to right justify several fields.
Code:
for x = 6 to 15
var$ = "#pbse.statictext" + str$(x)
stylebits #var$, _ES_RIGHT, 0, 0, 0
next x
r.m.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: type mismatch on stylebits
« Reply #1 on: Feb 3rd, 2015, 08:51am » |
|
on Feb 3rd, 2015, 12:37am, Alincon wrote:In LBB I get the message "type mismatch on this stylebits command. |
|
You cannot use a handle variable with STYLEBITS.
Quote:In LB4 it works to right justify several fields. |
|
I am surprised that it works in LB4. In LBB you can use MAPHANDLE:
Code: for x = 6 to 15
var$ = "#pbse.statictext" + str$(x)
read stext$
statictext #pbse.tmp, stext$, 10, x*20, 100, 12
stylebits #pbse.tmp, _ES_RIGHT, 0, 0, 0
maphandle #pbse.tmp, var$
next x
open "Multiple Statictext" for window as #pbse
wait
data "Text six", "Text seven", "Text eight", "Text nine", "Text ten"
data "Text 11", "Text 12", "Text 13", "Text 14", "Text 15" Richard.
|
|
Logged
|
|
|
|
Alincon
Full Member
member is offline
Posts: 147
|
|
Re: type mismatch on stylebits
« Reply #2 on: Jun 12th, 2016, 4:37pm » |
|
I finally got around to using Richard's maphandle example. I have replaced this Code:
textbox #psc.tb01, 420, 30, 50, 20
textbox #psc.tb02, 420, 60, 50, 20
textbox #psc.tb03, 420, 90, 50, 20
textbox #psc.tb04, 420, 120, 50, 20
textbox #psc.tb05, 420, 150, 50, 20
textbox #psc.tb06, 420, 180, 50, 20
textbox #psc.tb07, 420, 210, 50, 20
textbox #psc.tb08, 420, 240, 50, 20
stylebits #psc.tb01, _ES_NUMBER, 0, 0, 0
stylebits #psc.tb02, _ES_NUMBER, 0, 0, 0
stylebits #psc.tb03, _ES_NUMBER, 0, 0, 0
stylebits #psc.tb04, _ES_NUMBER, 0, 0, 0
stylebits #psc.tb05, _ES_NUMBER, 0, 0, 0
stylebits #psc.tb06, _ES_NUMBER, 0, 0, 0
stylebits #psc.tb07, _ES_NUMBER, 0, 0, 0
stylebits #psc.tb08, _ES_NUMBER, 0, 0, 0
with this:
Code:
call tbNumberMH "#psc.tb", 8
...
sub tbNumberMH x$,lmt
for x = 1 to lmt
var$ = x$ + "0"+right$(str$(x),2)
textbox #psc.tmp, 420, 30*x, 50, 20
stylebits #psc.tmp, _ES_NUMBER, 0, 0, 0
maphandle #psc.tmp, var$
next x
end sub
However, I have some other parts of the program where the textboxes are not aligned horizontally and/or vertically. Any suggestions on how to handle that situation?
r.m.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: type mismatch on stylebits
« Reply #3 on: Jun 12th, 2016, 9:10pm » |
|
on Jun 12th, 2016, 4:37pm, Alincon wrote:However, I have some other parts of the program where the textboxes are not aligned horizontally and/or vertically. Any suggestions on how to handle that situation? |
|
One or more DATA statements containing their coordinates and sizes, maybe? Something like this ought to work:
Code: for x = 1 to lmt
read x, y, w, h
textbox #psc.tmp, x, y, w, h
stylebits #psc.tmp, _ES_NUMBER, 0, 0, 0
var$ = x$ + "0"+right$(str$(x),2)
maphandle #psc.tmp, var$
next x Richard.
|
|
Logged
|
|
|
|
Alincon
Full Member
member is offline
Posts: 147
|
|
Re: type mismatch on stylebits
« Reply #4 on: Jun 13th, 2016, 01:42am » |
|
Yes, data statements might work, but wouldn't it be simpler to just code one stylebits statement for every text box?
What I really want is a new control: a 'numberbox' It would be similar to a text box, but only accept 0 - 9, decimal and minus. Or maybe add an optional parameter to the textbox to only accept numbers. I notice quite a few messages on the LB side with elaborate code to limit textbox input to only numbers. Maybe a 'numberbox' would be popular with those programmers, too.
r.m.
|
|
Logged
|
|
|
|
RNBW
Full Member
member is offline
Gender:
Posts: 106
|
|
Re: type mismatch on stylebits
« Reply #5 on: Jun 13th, 2016, 11:02am » |
|
on Jun 13th, 2016, 01:42am, Alincon wrote:Yes, data statements might work, but wouldn't it be simpler to just code one stylebits statement for every text box?
What I really want is a new control: a 'numberbox' It would be similar to a text box, but only accept 0 - 9, decimal and minus. Or maybe add an optional parameter to the textbox to only accept numbers. I notice quite a few messages on the LB side with elaborate code to limit textbox input to only numbers. Maybe a 'numberbox' would be popular with those programmers, too.
r.m. |
|
LBB has a quite simple solution to a "Numberbox" which allows calculator type entry of 0-9, "-" and "." into a textbox.
If you don't want calculator type entry, just use the sub at the end of the code (num$())
http://lbb.conforums.com/index.cgi?action=display&board=lblang&num=1462715049&start=15
Hope it's of use.
|
|
Logged
|
|
|
|
RNBW
Full Member
member is offline
Gender:
Posts: 106
|
|
Re: type mismatch on stylebits
« Reply #6 on: Jun 13th, 2016, 11:17am » |
|
on Jun 12th, 2016, 4:37pm, Alincon wrote:However, I have some other parts of the program where the textboxes are not aligned horizontally and/or vertically. Any suggestions on how to handle that situation?
r.m. |
|
If Richard's suggestion doesn't meet requirements, he provided a lot of guidance on the use of maphandle with grids of textboxes at http://lbb.conforums.com/index.cgi?board=lblang&num=1427909734&action=display&start=0
It may be worthwhile having a look at this. I know a lot of the code will not be of use but you might pick up something that helps with your problem. The code provided does not result in any misalignment vertically or horizontally.
Hope it's of use.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: type mismatch on stylebits
« Reply #7 on: Jun 13th, 2016, 11:24am » |
|
on Jun 13th, 2016, 01:42am, Alincon wrote:Yes, data statements might work, but wouldn't it be simpler to just code one stylebits statement for every text box? |
|
I assumed you had a large number of boxes and wanted to avoid the long-winded LB solution of a separate STYLEBITS and TEXTBOX statement for each one. In that case creating the boxes in a loop with DATA statements for the positions and sizes is more efficient.
But if you don't mind using the traditional LB method, with each box declared individually, of course that's fine too.
Quote:What I really want is a new control: a 'numberbox' It would be similar to a text box, but only accept 0 - 9, decimal and minus. |
|
A 'numberbox' already exists as far as the entry of unsigned integers is concerned (i.e. just the digits 0 - 9) - specify the _ES_NUMBER stylebit - but it doesn't accept either a minus sign or a decimal point.
Richard.
|
|
Logged
|
|
|
|
|