[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Re:Gui Snapshot/presets



On 29 Dec 2005, at 22:52, Saul Rayson wrote:

Hi Kernal,

Thanks for your help. But how do you source values from GUI objects and how do I implement the writeArchive and readArchive. Is there a help file in relation to this?

sorry for the delay...is this any help?

<x-tad-smaller>(
w = </x-tad-smaller><x-tad-smaller>SCWindow</x-tad-smaller><x-tad-smaller>.new.front;
a = </x-tad-smaller><x-tad-smaller>Array</x-tad-smaller><x-tad-smaller>.fill(8,{1.0.rand});

8.do{</x-tad-smaller><x-tad-smaller>|i|</x-tad-smaller><x-tad-smaller>
</x-tad-smaller><x-tad-smaller>Rect</x-tad-smaller><x-tad-smaller>(10+(i*25),10,20,127))
.action_({</x-tad-smaller><x-tad-smaller>|v|</x-tad-smaller><x-tad-smaller> a.put(i,v.value)})
.value_(a.at(i));
};

</x-tad-smaller><x-tad-smaller>Rect</x-tad-smaller><x-tad-smaller>(10,150,55,20))
.states_([[</x-tad-smaller><x-tad-smaller>Color</x-tad-smaller><x-tad-smaller>.blue]])
.action_({
a = </x-tad-smaller><x-tad-smaller>"/archiveExample"</x-tad-smaller><x-tad-smaller>);
8.do{|i| w.view.children.at(i).value_(a.at(i))};
});</x-tad-smaller><x-tad-smaller>


SCButton</x-tad-smaller>
<x-tad-smaller>(w,</x-tad-smaller><x-tad-smaller>Rect</x-tad-smaller><x-tad-smaller>(70,150,55,20))
.states_([[</x-tad-smaller><x-tad-smaller>Color</x-tad-smaller><x-tad-smaller>.white]])
.action_({a.writeArchive(</x-tad-smaller><x-tad-smaller>"/archiveExample"</x-tad-smaller><x-tad-smaller>)});


</x-tad-smaller><x-tad-smaller>Rect</x-tad-smaller><x-tad-smaller>(130,150,55,20))
.states_([[</x-tad-smaller><x-tad-smaller>Color</x-tad-smaller><x-tad-smaller>.blue]])
.action_({8.do{|i| a.put(i,1.0.rand); w.view.children.at(i).value_(a.at(i))}});

)</x-tad-smaller>




Thanks again,

Saul


On 28 Dec 2005, at 11:49, Saul Rayson wrote:

I wish to have some sort of preset snap shot of a gui I've built, so
the settings can be stored and opened.


like the MSP preset object?


On searching I've found PresetButtonViews...Does PresetButtonViews
work or is there a better way of doing this?


I tend to maintain an array of values sourced from GUI objects. so,
each time a slider is tweaked the corresponding value in the array is
updated.
then you can use Object's writeArchive and readArchive to read/write to
disk.

e.g

synthArg = [1,3,5,7,9,11];
SCSlider(w,Rect(10,10,127,20)).action_({|v| synthArg.put(0,v.value)})
synthArg.writeArchive(filePath);
Object.readArchive(filePath);

perhaps you can think of other ways to use these archiving facilities?

kernel.

_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users