Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: New to list

From: jeperk:swbell at: 9-Jun-2003 16:13

Here is some code you might be interested in. It should also give you an idea of exactly what I am trying to do. I am making a (for lack of a better word) "gummy" widget. It stretches and slides to show length, start and end information visually. I planned to use it in a GUI for Linux fdisk, a scheduler, audio/video applications, anything that could display multiple linear pieces. As you can see, you never know how many you would need before hand. I've been playing with Linux configuration tools for a while and worked out a deal with REBOL to allow the source code to be released under GPL with the understanding that to recompile the apps would require the Linux REBOL SDK. You would get the executable and the source, but to make changes, you have to buy the SDK. If anyone knows how to integrate this as a normal "button" type thing, please let me know. If REBOL wants to include a working version in REBOL/VIEW, you have my full permission, free of charge. (just clean it up and help me make it work!) I have added a hack to allow the right mouse button menu to work under Linux. On Linux view, the right mouse events behave differently than in Windows. It constantly sends over and away messages. This runs with the current stable VIEW releases. Thanks, John Here is the code: REBOL [ Title: "Gummy" Date: 27-May-2003 Version: 0.0000001 File: %gummy.r Author: "John Perkins" Purpose: {Trying to create a widget for showing length, start, end, etc. It would be useful for audio/video apps, GUI for linux fdisk, scheduling, who knows what else. Buggy as hell at the moment. } Email: [jeperk--swbell--net] Note: "Help? How can I make this usable like a button or slider? So that I can include it multiple times simply?" ] ;#include %../source/mezz.r ;#include %../source/prot.r ;#include %../source/view.r ; I mostly use SDK. Why does Linux /VIEW(not SDK) make such HUGE fonts?" rc: false view layout [ size 300x300 style inpoint box 6x40 font-size 11 feel [ engage: func [face action event] [ if action = 'down [face/data: event/offset] if find [over away] action [ face/offset/x: face/offset/x + event/offset/x - face/data/x if face/offset/x > op1/offset/x [face/offset/x: op1/offset/x - 1] mp1/size/x: op1/offset/x - face/offset/x mp1/offset/x: face/offset/x mp1/text: mp1/size/x ip1/text: ip1/offset/x show system/view/screen-face/pane/1 ; <----Have to show everything, or else I get BAD redraw errors ] ] ] style outpoint box 6x40 font-size 11 feel [ engage: func [face action event] [ if action = 'down [face/data: event/offset] if find [over away] action [ face/offset/x: face/offset/x + event/offset/x - face/data/x if face/offset/x < ip1/offset/x [face/offset/x: ip1/offset/x + 1] mp1/size/x: face/offset/x - mp1/offset/x mp1/text: mp1/size/x op1/text: op1/offset/x show system/view/screen-face/pane/1 ] ] ] style midpoint box font-size 11 feel [ engage: func [face action event] [ if action = 'down [face/data: event/offset] if find [over away] action [ if rc = false [ face/offset/x: face/offset/x + event/offset/x - face/data/x ip1/offset/x: face/offset/x op1/offset/x: face/offset/x + face/size/x mp1/text: mp1/size/x ip1/text: ip1/offset/x op1/text: op1/offset/x show system/view/screen-face/pane/1 ] ] ; ------------------------------help me below - alt-down is also triggering the drag code with over and away if action = 'alt-down [rc: true inform layout [ text "Some kind of menu goes here, but it won't let go and clicking in the main window sends it out of range!" button "I feel your pain" [ rc: false hide-popup] ] rc: false ] ;------------------------------to right here (fixed with rc toggle, now works in win and lin) ] ] across mp1: midpoint "Drag Me" 40x40 black at mp1/offset ip1: inpoint "IN" navy at 60x20 ;<-------------------How to avoid hard coding this? op1: outpoint "OUT" teal at 60x90 below text "Drag the IN and OUT points to adjust length." text "Drag the middle to adjust position." text "Right-click for a broken menu." text "The values are shown for debugging." text "Still to add things like max length, etc." ;button "probe it" [print "debug" probe mp1/offset probe mp1/size probe op1/offset] ]