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

World: r3wp

[View] discuss view related issues

ChristianE
15-Apr-2005
[921]
Does anybody know if it's possible to catch third mouse-button's 
up and down events? I know of the scroll-line and scroll-page thing, 
but ...
Anton
15-Apr-2005
[922x3]
I don't think so. Let me check the binary :)
Nope, there's only down, alt-down, up, alt-up
On windows maybe the system port will see the WM_MBUTTONDOWN & UP 
messages.
Volker
16-Apr-2005
[925]
Did you know you can do the whole markup with iterated faces? 1766 
markups ~8000kb.
Anton
17-Apr-2005
[926]
ChristianE, see (if you haven't already) the "Windows (MS)" group, 
where I posted some extra notes showing the beginning of how these 
messages can be captured using the system port (only on Windows, 
obviously).
DideC
20-Apr-2005
[927]
I remember reading problem about using serial port with View window 
: you have to move mouse to get proper serial transfer (if not port 
take 1 sec to respond). Can't remember what was the conclusion about 
it ?
Anybody ?
Graham
20-Apr-2005
[928]
Petr says he owes me a beer cause I told him the solution to that 
.. but now I can't recall what it was!  :(
Pekr
20-Apr-2005
[929x3]
neither I .... hmm, I will look into my sources ...
wasn't it addition of timer to layout?
timer: sensor 1x1 rate 0:01 feel [
        engage: func [face action event] [
            if all [action = 'time] [
                do-face face none
            ]
        ]
    ]
Graham
20-Apr-2005
[932]
yes, I think it was.
Anton
25-Apr-2005
[933x2]
www.rebol.net is working (showing the new server) OK.
link to rambo is OK  (and rambo lists newest bug OK.)
link to http://mail.rebol.net/::: 503 Connect failed

Your request for http://mail.rebol.net/could not be fulfilled, because 
the connection to mail.rebol.net (209.167.34.210) could not be established.
(sorry)
Gregg
27-Apr-2005
[935]
Paul, irregular windows - Cyphre did one I'm pretty sure.
[unknown: 5]
27-Apr-2005
[936]
Thanks Gregg.
Ashley
27-Apr-2005
[937]
http://www.rebol.cz/~cyphre/trans-gui.r
http://www.rebol.cz/~cyphre/trans-win.r
ChristianE
2-May-2005
[938x2]
Is this a bug or by design?


A faces pane, if of type block!, may contain not only face objects, 
but allows for words too (and maybe other types, but I didn't check 
this). At least it works and View doesn't complain.  

I sometimes use this for easy access of faces in crowdy pane; e.g. 
for faces A, B, C and F I can set do F/PANE: REDUCE ['a A 'b B 'c 
C].


But now I noticed in some popup-faces' code that SYSTEM/VIEW/WAKE-EVENT 
fails in such cases because of the line IF GET IN ITEM 'ACTION [BREAK/RETURN 
FALSE], which I had to patch to IF ALL [OBJECT? ITEM IN ITEM 'ACTION] 
[BREAK/RETURN FALSE] to make it work through such panes.


Well, I'm really uncertain whether it is a good idea to build panes 
that way and if I have to think of WAKE-EVENT as being buggy, or 
if by design pane blocks really should consist of nothing but faces 
and the bug is me ignoring that.

So, what do you think?
I should have mentioned that I do that to - in the above example 
- refer to the face B by F/PANE/B without having to extend F with 
an explicit 

'reference' to B as in F: MAKE FACE COMPOSE [A: (A) B: (B) C: (C) 
PANE: (REDUCE [A B C])].
Anton
3-May-2005
[940]
Christian, I don't think there are any official docs on the contents 
of pane, but I would avoid this approach. Most code would be expecting 
only faces, eg. code that shuffles faces in order to do depth arrangement 
is probably not expecting words in there too (and, if it did expect 
them, should it assume the words are associated with the faces ?)
Gabriele
3-May-2005
[941x2]
there are two problems: some mezzanine code doesn't work with that 
(but this could be fixed), and view actually tries to lookup the 
words.
that is, if your pane is [b], and b references a face, view will 
look it up and use it as if the face object was there instead of 
the word. because of this, your faces will be in the pane TWICE as 
per the example above.
Allen
3-May-2005
[943]
IIRC Cyphre used this approach (using words or lit-words) in SWIS. 
It does make lookups quite simple, but then again it is not too hard 
to maintain a separate index block if needed. Keepning the workload 
down for the rendering of faces is probably a good reason to avoid 
the 'word approach.
Volker
3-May-2005
[944x2]
Strictly I would call wake-event buggy. But then popup-faces are 
usually not that complex. So its a 80/20, the complex faces are easier 
with words, the simple popups a bit  restricted.
So i favor christians patch.
ChristianE
3-May-2005
[946x3]
Gabriele, thanks for the "being in the pane TWICE" explanation: you 
pointed me to a mysterious "face in more than one pane" error message 
I wasn't able to track down to it's origin. Should've read "face 
more than once in pane", though ;-)  Then again, it seems to work 
fine if the word-lookup doesn't evaluate to a face (even non-face 
objects seem to be allowed).


Did you had some special mezzanines in mind which may stumble over 
this? WAKE-EVENT currently is the first and only one I know of for 
now. Of course the number of idioms like FOREACH FACE PANE [FACE/...] 
is legion, so this really may turn out to be problematic.
Allen, yes, I too expected the extra type cast required to eventually 
slow down the view engine. As always, it seems to be the old choice 
between being fast or elegant. But please don't cite me as saying 
that fast code couldn't be elegant ;-)
It's just that the approach seems to fit into the 'code is data and 
data is code' idea quite nice.
Gabriele
3-May-2005
[949]
christian: i remeber seeing the "bug" in the event func that handles 
keys, too.
ChristianE
3-May-2005
[950]
Fine, thank you, I'll have a look at that.
Gabriele
3-May-2005
[951x2]
(that is, i once had a panel with buttons that had a key defined; 
the keys worked in one case but not in another. basically, in one 
case i was using a style that used words instead of faces in the 
pane - so it was easier to probe it for testing - and the function 
find-key-face didn't recurse into that pane)
so there's a possibility that this is going to happen somewhere else 
too... everyone is just expecting faces there, if pane is a block.
ChristianE
3-May-2005
[953x2]
Yes, you name the problem. I'm very likely will choose something 
like Allen suggested or store the references in the face's user-data. 
They're fixed number, so that wouldn't be much work, it just makes 
code somewhat lengthy in comparison. Thanks again!
While wer're at it - I guess this is known: VIEW MAKE FACE [PANE: 
SELF] crashes REBOL without warning, or, to give it another name, 
causes the interpreter to quit silently instead of telling me that 
trying this really makes no sense. I couldn't find something related 
in RAMBO, though.
Gabriele
4-May-2005
[955]
christian: add it to rambo please.
ChristianE
4-May-2005
[956]
Added as RAMBO Ticket #-205
Gabriele
4-May-2005
[957]
#3678
BrianW
4-May-2005
[958]
The more I mess with ImageMagick and PIL, the more I like Draw :-)
Micha
5-May-2005
[959x2]
sortuj: [  items:  sort/compare  items func [a b ][(pick a n) < pick 
b n]
            save %data.txt items          
            show lay              ]


dodaj: [a: to-url tx/text 

        items: append array/initial 1 reduce [ a  [] [] [] ] items 
        show lay  ]


p:  [    field 200  field 100  field  100  field 100  field 100 return]


add: func [ /local coll] [ coll: get in  layout/offset/origin p  
0x0 1x1 'pane
                           insert tail sub-panel/pane coll  ]

sub-panel: layout [space 2x2
        across 
        origin 1x1
        ; style label text bold right 60
        backcolor blue

       field 200  field 100  field  100  field 100  field 100 return

       field 200  field 100  field  100  field 100  field 100 return 


          ]


lay: layout [

    origin 5x5
    space 1x0
              
 across

   txt 20 "url"    tx: field  270 txt 30 "add" [do dodaj] txt 100 center 
   "sprawdz" [] 
 return
        
 across
h3 200 center red "www" [n: 1  do sortuj   ] 
h3 100 center red "ip"[n: 2 do sortuj ] 
h3 100 center red "nazwa" [n: 3  do sortuj ]
h3 100 center red "kraj" [n: 4 do sortuj]
h3 100 center red "agent" [n: 5  do sortuj ]
 return
        space 0
        panel: box  610x400 blue
        s1: scroller 16x400 [scroll-panel-vert panel s1]
        return
        s2: scroller 300x16 [scroll-panel-horz panel s2]
        return
        button "halt" [halt]
    ]

    panel/pane: sub-panel

    scroll-panel-vert: func [pnl bar][

        pnl/pane/offset/y: negate bar/data * (max 0 pnl/pane/size/y - pnl/size/y)
        show pnl
    ]

    scroll-panel-horz: func [pnl bar][

        pnl/pane/offset/x: negate bar/data * (max 0 pnl/pane/size/x - pnl/size/x)
        show pnl
    ]

    update-panel: func [pnl vbar hbar] [
        pnl/pane/offset: 0x0
        s1/data: s2/data: 0
        hbar/redrag pnl/size/x / pnl/pane/size/x
        vbar/redrag pnl/size/y / pnl/pane/size/y
        
        show [pnl vbar hbar]
    ]

    update-panel panel s1 s2
    view/new lay

do-events
how to add columny ?
eFishAnt
6-May-2005
[961]
Doc's Win95 demo (in Demo's folder of ViewTop breaks on layout/trace, 
looks like build is involved, but the file is %win95.zip ... on some 
recent /Views, didn't test all the way back to where it works, but 
has anyone fixed or know much about it?
Henrik
6-May-2005
[962]
is there a quick way to set a maximum length of text in a field and 
automatically unfocus and move to the nexst field in the tab order? 
E.g. day, month and year fields with limits 2, 2 and 4 and automatically 
jump to the next field
Izkata
6-May-2005
[963x4]
I know of a way, but I wouldn't call it quick - override the engage 
func. for a field and take advantage of the 'parent-face var in the 
object... I'll start a quick example if you want to see it
Uggh sorry I can't think right now..
Okay, here's an example - I don't yet know much about styles, so 
there's certainly a better way out there...
Jumplength: 3

stylize/master [
   JumpField: field with [
      make multi [
         integer: func [face blk][]
      ]
   ] feel [
      engage: func [face b c][ 
         if b = 'down [show face focus face]
         if b = 'key [
            if char? c/key [
               switch/default c/key [
                  #"^H" [
                     remove back tail face/text
                  ]
                  #"^M" []

                  #"^-" [focus first next find face/parent-face/pane face]
               ][
                  if none? face/text [face/text: copy {}]
                  append face/text c/key
                  if JumpLength <= length? face/text [
                     unfocus face
                     TMP: next find face/parent-face/pane face
                     error? try [

                        while [all [TMP/1/style <> 'JumpField  not empty? TMP]][TMP: next 
                        TMP]

                        if TMP/1/style = 'JumpField [clear TMP/1/text show TMP/1 focus TMP/1]
                     ]
                  ]
               ]
               system/view/caret: tail face/text
               show face
            ]
         ]
      ]
   ]
]

view center-face layout [
   across
   text {Length of 3:}
   JumpField
   return
   text {Length of 3:}
   JumpField {Already Here!}
]
Henrik
6-May-2005
[967x2]
it's a bit buggy... when I select a field and start typing something 
when it already has a length > 3, the first character I write is 
printed and it jumps to the other field
this is definitely something that should be a whole lot easier to 
work with...
Izkata
7-May-2005
[969]
As I said, I'm still new to styles - hopefully someone with more 
experience will come along and do something better...
Henrik
7-May-2005
[970]
nice try though :-)