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

World: r3wp

[!RebGUI] A lightweight alternative to VID

Graham
20-Apr-2007
[6248x2]
How to programmatically change the date displayed in a calendar widget 
that is currently being displayed?
tried setting the widget/data: now/date and doing an 'init
Ashley
20-Apr-2007
[6250]
Like the set-text change (and code re-factoring).


Not sure about the alignment question, have an example in VID of 
what you're trying to do?

Calenday quetion is easy:

	cal/date: 1-Feb-2006
	poke cal/options 1 1-Feb-2006
	show cal

data is the currently selected date
options/1 the default date
Graham
20-Apr-2007
[6251x3]
That's okay about the alignment .. I just used a panel to do what 
I wanted.
I had a 


calendar widget1 return widget2 and I wanted widget2 to align with 
the right border of the calendar

so now I have

calendar panel blue data [ widget1 return widget2 ]
typo :)

cal/data: 1-Feb-2006
poke cal/options 1 1-Feb-2006
show cal
Ashley
20-Apr-2007
[6254x2]
Note that in your panel example you can make it act like a positioning 
widget with something like:

	panel none data [margin 0x0 area return area]
Remember how we wrapped current-word and caret handling in attempt 
blocks? Well, I've had plenty of caret errors to track down but not 
a single current-word error. Then I recall you had that problem where 
you set face/text to a non-string value ... could the current-word 
problems you experienced be related to that?
Graham
20-Apr-2007
[6256x4]
I don't think so ... but it's hard to remember all of this now.
trap and forget ...
I would have posted the error messge here .. let me reset my search 
parameters for Altme
here it was:

make object! [
    code: 303
    type: 'script
    id: 'expect-arg
    arg1: 'find
    arg2: 'series
    arg3: [series! port! bitset!]

    near: [s: any [all [s: find/reverse str s next s] head str] set [ns]]
    where: 'current-word
]
Ashley
20-Apr-2007
[6260]
I'm trapping and writing these errors out to %rebgui.log, does your 
log file contain any current-word errors? (search for "word trap" 
if there are lots of entries)?
Graham
20-Apr-2007
[6261x2]
just lots of 

19-Apr-2007/18:18:20+12:00 Caret trap password origin: 2x2
margin: 2x2
indent: 0x0
tabs: 0
wrap?: false
scroll: 0x0
but then I had already wrapped an attempt around those
Ashley
20-Apr-2007
[6263]
But at least you haven't had a current-word error since installing 
the latest builds. It's just that looking at the current-word function, 
it's only called from one place, and you already have to have focus 
and caret with a valid string before the function is called, i.e. 
I can't see how it *could* fail [now]. I'll probably leave the attempt 
in there for a couple more builds/weeks, but if it traps no errors 
I'll remove it as fixed.
Graham
21-Apr-2007
[6264x2]
select-row is not working?


>> display "" [ t: table options ["row" left .99] data [ "a" "b" 
][ print face/selected ] button "select" [ t/sele
ct-row 1 ]] do-events
the action is not invoked when I use the button
Ashley
21-Apr-2007
[6266]
Missed that one when I converted actions over to on-*. Change:

	unless no-action [action self]

in %table.r to:

	unless no-action [action/on-click self]

Text-list is OK.
Graham
21-Apr-2007
[6267x5]
ok.
typo ... in tour.r unziped should be unzipped
Has anyone got a good ellipsis button to use to indicate that one 
can bring up a directory requestors etc eg. button ".."
I was thinking of using the eye symbol in the webdings ie. "N"
Doesn't look too out of place
there is the magnifying glass "L"
Ashley
21-Apr-2007
[6272]
That caret "bug" you were having may not be the same one I'm fixing. 
Try this:

	display "" [
		f: field
		field
		button [print f/caret]
	]


f/caret is correctly set when you tab or mouse click out of the field. 
It is not set when you click the button. So far, so good. Do you 
have a different usage case that causes a problem?
Graham
21-Apr-2007
[6273x4]
well, the caret is not set if you click inside f
you can click inside f, and type and the caret values does not change
for me, it only gets set on a tab
so mouse clicking out of the field does not set the caret
Ashley
21-Apr-2007
[6277]
1) The caret value is set when the widget loses focus. The original 
purpose was to remember where you were in the text if you left it. 
Updating the caret after every keystroke is a bit extreme. If you 
want to get the caret position in a face that currently has focus 
just use "index? system/view/caret"


2) When I run the code given above I click in the first field, then 
the second, then press the button to have a "1" displayed. You don't 
get the same result?


3) Dictionary symbol. Have you tried the "book" symbol? Wingding 
"&" I think.
Graham
21-Apr-2007
[6278x5]
I primarily want to click inside a body of text to place the caret, 
and then push a button to insert a block of text
2.  Usually I find that the caret does not change at all.
I suspect it would not be particularly overkill to track the caret 
on every keystroke ... editors do it all the time.
otherwise text insertion is going to be hit and miss
it violates gui principles if you claim the ability to insert at 
the caret, but it inserts elsewhere
Ashley
21-Apr-2007
[6283]
click inside a body of text to place the caret, and then push a button 
to insert a block of text

 Ah, got it. The solution is simple then. We add a line to set-text 
 (after the string? test) that reads:


 all [view*/caret none? face/caret face/caret: index? view*/caret]
Graham
21-Apr-2007
[6284x2]
let me try :)
make object! [
    code: 311
    type: 'script
    id: 'invalid-path
    arg1: 'caret
    arg2: none
    arg3: none

    near: [all [view*/caret none? face/caret face/caret: index? view*/caret] 
        insert either all
    ]
    where: 'show-text
]
Ashley
21-Apr-2007
[6286x2]
Probably needs to read:


 all [caret view*/caret none? face/caret face/caret: index? view*/caret]

If this works the whole thing can be refactored a bit.
Error looks like the widget hasn't got a caret aatribute.
Graham
21-Apr-2007
[6288x3]
Nope, not working.
It's inserting at the head of the face and not at the caret after 
clicking on the text in the area
head of face/text
Ashley
21-Apr-2007
[6291x3]
Let me try here ...
Update set-text with:

	unless string? face/text [exit]
	insert either caret [
		if all [
			none? face/caret
			face = view*/focal-face
			view*/caret
		] [face/caret: index? view*/caret]
		either face/caret [at face/text face/caret] [tail face/text]
	][
		clear face/text
	] form text
Then run the following:

	display "" [
		f: field
		field
		button [set-text/caret f "X"]
	]


Click in f, type some text, click or arrow to the middle of the text 
and press the button. Text is inserted at caret.
Graham
21-Apr-2007
[6294x2]
not for me
still requires a tab to set the caret position correctly
Ashley
21-Apr-2007
[6296x2]
Hmm, maybe there are other changes at play here. Let me upload latest 
build ...
Build uploaded.