r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!RebGUI] A lightweight alternative to VID

Ashley
8-Dec-2006
[5027]
Works here. Are you sure the label is not being set/changed dynamically? 
Which raises the interesting question of whether the show-text, data 
and title funcs should be "locale aware" ...
Graham
8-Dec-2006
[5028x4]
Yes, it is not being changed dynamically.
Must be my old distro that I am still using.
I'll do some tests with the latest.
but I do have some labels, buttons where the text is changed dynamically
Ashley
8-Dec-2006
[5032x2]
Localization code hasn't changed for a long time, so I doubt it's 
a build# problem.
The test I ran here was a single label in a group-box within a tab-panel 
within a tab-panel within a tab-panel.
Graham
8-Dec-2006
[5034x2]
which is what I have here.
I wonder if it's because I use ":" at the end of my labels
Ashley
8-Dec-2006
[5036]
That would be it. "Name:" <> "Name"
Graham
8-Dec-2006
[5037x3]
Hmm. Screws it up.
words: [
Occupation:
 "Occ:"
	"Bytes"			"Octets"
	"Cancel"		"Annuler"
Instead of "Occ:" the label is now showing "Bytes"
Ashley
8-Dec-2006
[5040]
Probably because you don't have a space between "Occupation:" and 
 "Occ:"
Graham
8-Dec-2006
[5041x5]
I do ..
one space and two tabs
just added those to be sure.
just tried it with other words . it causes the locale to skip the 
following word
for me anyway
Ashley
8-Dec-2006
[5046]
Reproduced it, very odd. Looking at it now ...


re dynamic translations. Reading Gabriele's comments in the chat 
group on his TRANSLATE func got me to thinking we could do something 
similar, as in:

	display "Test" [
		button "Old Text" [face/text: translate "New Text" show face]
	]


'translate would return a string translation if passed a string, 
otherwise a block of translated strings if passed a block.
Graham
8-Dec-2006
[5047x3]
why not just show-translate instead of show-text ?
or, show-text translate "sometext"
show-text widget translate "sometext"
Ashley
8-Dec-2006
[5050x2]
Yep, that's how it works The important point in the example I posted 
was not that it didn't use show-text, but that it is a func that 
is called to explicitly translate string(s) used by other function(s).
For your label problem, how many words are defined:

	...
	button [print length? ctx-rebgui/locale*/words]
Graham
8-Dec-2006
[5052x4]
Seems to me you might as well put the translate inside show-text
64
even !
hmm.  retract that ... regarding show-text
Ashley
8-Dec-2006
[5056]
hmm ... retract my being able to reproduce the problem. Change your 
locale.dat file to have the following:

words: [
	"AA:"	"A:"
	"BB:"	"B:"
]

and verify labels "AA:" and "BB:" are translated correctly.
Graham
8-Dec-2006
[5057]
AA: gives me BB:
Ashley
8-Dec-2006
[5058]
Really? Even with code as simple as:

	display "Test" [label "AA:"]


The code that does the translations is nothing more than a simple 
select, which you can run manually by adding a halt to your code 
and doing the following from the console:

	select ctx-rebgui/locale*/words "AA:"
Graham
8-Dec-2006
[5059x4]
It's not the ":" .. all my labels are doing this.
I get "A:"
but BB: as the label!
well, this is very puzzling.
Ashley
8-Dec-2006
[5063]
Maybe it is something to do with the build# after all. I'm running 
on build#46 here.
Graham
8-Dec-2006
[5064]
Oh well ...
Ashley
8-Dec-2006
[5065]
In the above example it is vey important that the label was "AA:" 
not "A:" (which would explain a "BB:" result returned by select)
Graham
8-Dec-2006
[5066x2]
personalgb: group-box "Personal" 77x35 data [  
    label "AA:" ethnicfld: edit-list 50 "Caucasian" 
data [
Build 46 works okay.
Ashley
8-Dec-2006
[5068]
Nailed it ... you can reproduce the error with:

	display "Test" [
		label "AA:"
		group-box "Test" data [label "AA:"]
	]


The block handling code seems to be the culprit ... investigating.
Graham
8-Dec-2006
[5069]
Whew! :)
Ashley
8-Dec-2006
[5070]
Build#47 committed to SVN, fixes locale bug and adds new translate 
function as described above.
Graham
9-Dec-2006
[5071x5]
Regarding 'put-input, I don't think you should report an error if 
there is insufficient data ...
this is with build 47
display "" [ r: radio-group data [ "M" "F" ] button "M" [ r/select-item 
1 ] button "F" [ r/select-item 2 ] button "
Probe" [ probe r/selected] ] do-events
note that whatever the state of the radio-button, the selected value 
is always none, and the radio buttons are not mutually exclusive 
:(
The values are only 1 and 2 if the mouse is used to select the radio 
buttons
Ashley
9-Dec-2006
[5076]
Build#48 committed to SVN, incorporating Robert's/Cyphre's extensive 
changes ((including new chart, drop-tree, grid, input-grid & panel 
widgets). Panel & Input-Grid added to %tour.r.


These new widgets (apart from panel) have an impressive range of 
options/features ... but scant documentation or usage examples. If 
Robert/Cyphre could post a few examples here that would help. If 
anyone reads the source code and figures something out then an entry 
or two here would be appreciated: http://trac.geekisp.com/rebgui/wiki/WidgetList