|
Post by kokenge on Mar 11, 2009 9:01:10 GMT -5
|
|
|
Post by Brent on Mar 11, 2009 13:20:10 GMT -5
Hi Dan, To put a double-quote inside an RB string, you have to double them. q$ = """" ' one quote qq$ = """""" ' two quotes html "<script type=""text/javascript""></script>" However, you seem to have another problem. It looks like you are attempting to generate RB code using JS. Scripts are run inside the browser. Your browser doesn't know RB from a hole in the ground. If you want a LINK inside a table, you have to break the table into chunks. html "<table><tr><td>" link #lnk,"Link", html "</td></tr></table>" It's not pretty, but it's necessary.
|
|
|
Post by kokenge on Mar 11, 2009 13:40:24 GMT -5
Thanks Brent.
However the problem is I have about 10 tables doing various things and located in various places on the screen.
I do not know what links I need in various places on the screen, or even if I need the link. All depends on the action of the user and the situation.
So I need to place the link in the table at a later time.
Double quotes don't seem to work. The RB link command generates single quotes within it. And since the SCRIPT uses a single quote to enclose the data, it gets destroyed by the link command. I've tried several Ascii codes but haven't been able to find the right one.
Dan
|
|
|
Post by Brent on Mar 11, 2009 15:45:16 GMT -5
I don't know what kind of application you are developing, so if the following question doesn't apply, please consider it rhetorical.
Do you save so much bandwidth deciding whether some links or buttons should be rendered that it offsets the time it takes to decide?
Suppose it takes 1 second to render a page deciding which controls to render. If the same page just rendered controls regardless of the data, it may take half the time to render, but uses more bandwidth. If the user clicks a link that doesn't make sense for the data, he or she gets an error message like "No items to edit. [Add items] or [return to previous page]" which may take 1/10 of a second to render.
|
|
|
Post by kokenge on Mar 11, 2009 16:13:48 GMT -5
Yes I do save bandwidth. But that isn't the problem. The screens would be complex to redraw. Much simpler to simply change the data on the screen. Here is just a simple piece of the screen. They can decide if they want a pop calendar or not. The screen has several dates for different things. So they may ask for date pops several times. It also has some other complex issues, but it would take too long to explain, and too much code to post here. It would be a lot of "round trips" painting the screen each time. Plus a lot more code. So here is a simple example, that I'd love to use links instead of buttons. Links would make the pop calendar smaller. html "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD>" textbox #poDate,poDate$,19 #poDate setid("poDate") button #poDatePop,"?", [poDate] #poDatePop setkey("poDate") html "<TD id=poDatePop></TD></TR></TABLE>"
wait ' ------------------------------------- ' Date Picker ' ------------------------------------- [poDate] a$ = #poDate contents$() at$ = " ";trim$(word$(a$,2," ")) goto [datePicker]
[datePicker] if mth$ = "" then mths$ = "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec" sqliteconnect #mem, ":memory:" ' make in memory db #mem execute("SELECT strftime('%Y-%m-%d','now')") today$ = #mem nextrow$("") end if
if a$ = "" then a$ = today$ a$ = a$ + "- -" yr = val(word$(a$,1,"-")) if yr < 100 then yr = val(word$(today$,1,"-")) mm = val(word$(a$,2,"-")) if mm < 1 or mm > 12 then mm = val(word$(today$,2,"-"))
if dtePop$ <> "" and dtePop$ <> EventKey$ then html "<script> document.getElementById('";dtePop$;"Pop').innerHTML = '';</script>" end if
dtePop$ = EventKey$
[picket] gosub [getMonthInfo] x = 0 html "<script> document.getElementById('";dtePop$;"Pop').innerHTML = '" html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 bgcolor=wheat><TR>" html "<TD colspan=7 align=center>" button #bback,"<<",[bback] button #back,"<",[back] html " ";word$(mths$,mm,",");" ";yr;" " button #fwd,">",[fwd] button #ffwd,">>",[ffwd] html "</TD><TR align=center><TD>Sun<TD>Mon<TD>Tue<TD>Wed<TD>Thr<TD>Fri<TD>Sat<TR align=center>"
for i = 1 to mmDays + dow if i > dow then x = x + 1 if x = 0 then html "<td></td>" else html "<TD>" button #sd,str$(x),[sd] #sd setkey(x) html "</TD>" end if if (i mod 7) = 0 then html "</TR><TR align=center>" next i html "</TR></table>" html "';</script>" wait
' back a year [bback] yr = yr - 1 if yr < 1 then yr = val(word$(today$,1,"-")) goto [picket]
' back a month [back] mm = mm - 1 if mm < 1 then mm = 12 yr = yr - 1 end if goto [picket]
' forward a year [ffwd] yr = yr + 1 if yr > 9999 then yr = val(word$(today$,1,"-")) goto [picket]
' forward a month [fwd] mm = mm + 1 if mm > 12 then mm = 1 yr = yr + 1 end if goto [picket]
' select date [sd] dd$ = right$("0";EventKey$,2) mm$ = right$("0";mm,2) html "<script> document.getElementById('";dtePop$;"').value = '";yr;"-";mm$;"-";dd$;at$;"';</script>" html "<script> document.getElementById('";dtePop$;"Pop').innerHTML = '';</script>" dtePop$ = "" wait
[getMonthInfo] ' ---------------------------------------- ' day of week when month begins. ' days in a month ' ---------------------------------------- if yr < 100 then yr = val(date$("yy")) if mm < 1 or mm > 12 then mm = val(date$("mm")) dayOne$ = str$(yr) ; "-" ; right$("0";str$(mm),2) ; "-01" sql$ = "SELECT strftime ( '%w','";dayOne$;"') as dow, date('";dayOne$;"','start of month','+1 month','-1 day') as emo" #mem execute(sql$) result$ = #mem nextrow$(" |") dow = val(word$(result$,1,"|")) ' Day of Week month begins eom$ = trim$(word$(result$,2,"|")) ' End of month mmDays = val(word$(eom$,3,"-")) ' Days in Month RETURN
I can post the entire program if it would help. It is a shopping cart program with user defined screen layouts. So it is dynamic.. HTH.. Dan
|
|
|
Post by StefanPendl on Mar 12, 2009 3:02:27 GMT -5
html "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD>" textbox #poDate,poDate$,19 #poDate setid("poDate") button #poDatePop,"?", [poDate] #poDatePop setkey("poDate") html "<TD id=poDatePop></TD></TR></TABLE>"
'---snip
In the above there is one TD too much. html "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD id=poDatePop>" textbox #poDate,poDate$,19 #poDate setid("poDate") button #poDatePop,"?", [poDate] #poDatePop setkey("poDate") html "</TD></TR></TABLE>"
Since you like to have them all as separate objects, place them into separate BAS files, RUN those and RENDER as you like. Still there is the problem of swapping objects, but you could define two functions inside the BAS files one to display and one to clear. function display() print "I am here!" end function
function clear() cls end function
|
|
|
Post by kokenge on Mar 12, 2009 5:10:19 GMT -5
You probably noticed when you ran the code I supplied above, that the POP UP date picker needs to know where tp display. That is the reason for the extra "<TD id=poDatePop>"
Also noticed when you click the [?] button that the calendar that pops up uses BUTTONS for the dates. Once you pick a date the POP UP disappears. When I change the pop up calendar to use LINKS instead of BUTTONS it will not work.
I still cannot place a LINK in a "<SCRIPT>" , only BUTTONS,
The problem I have with the RUN command is that I cannot figure out how to place data in certain areas of the screen. But that should probably be another post.
Thanks for the help. Dan
|
|
|
Post by StefanPendl on Mar 12, 2009 6:15:00 GMT -5
You probably noticed when you ran the code I supplied above, that the POP UP date picker needs to know where tp display. That is the reason for the extra "<TD id=poDatePop>" Every TD open tag needs one TD close tag, you had two TD open tags, but only one TD close tag. Your sequence was: TABLE, TR, TD, TD id, /TD, /TR, /TABLE, which misses one /TD. I changed this to TABLE, TR, TD id, /TD, /TR, /TABLE, which seemed to me what you had in mind.
|
|
|
Post by kokenge on Mar 12, 2009 6:39:52 GMT -5
I rarely use the close </TD> tag. Official HTML docs say they need it, but they all work without it.
However, in any event, I closed the <TD> tag in the above example, reran it, and it works with Buttons as it did before without the closed </TD>.
I changed one of the buttons in the code above to a link : button #bback,"<<",[bback] to link #bback,"<<",[bback] Reran it, and it still does not work.
So I still cannot put a link in a "<SCRIPT>'
Thanks for the help.. Dan
|
|