From: Andrey C. <sku...@us...> - 2006-10-18 08:50:10
|
Update of /cvsroot/eas-dev/clip-ui In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv6918 Modified Files: ChangeLog TODO form.prg special.prg table.prg window.prg Log Message: - Window now support spacing and padding in form - Pass both id and text for UIChoice - getValues() method ignore named buttons - UIChoice support setValue/getValue as array { text, id } Index: ChangeLog =================================================================== RCS file: /cvsroot/eas-dev/clip-ui/ChangeLog,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ChangeLog 5 Jun 2006 20:34:49 -0000 1.2 +++ ChangeLog 18 Oct 2006 08:49:59 -0000 1.3 @@ -1,3 +1,9 @@ +2006-10-16 + - Window now support spacing and padding in form + - Pass both id and text for UIChoice + - getValues() method ignore named buttons + - UIChoice support setValue/getValue as array { text, id } + 2006-06-06 - UIFrame now support :layout widget for setup background ("color.bg") Index: TODO =================================================================== RCS file: /cvsroot/eas-dev/clip-ui/TODO,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TODO 2 Jun 2006 14:12:09 -0000 1.1 +++ TODO 18 Oct 2006 08:49:59 -0000 1.2 @@ -2,7 +2,13 @@ TODO ==== -Last change: 06 Apr 2006 +Last change: 16 Oct 2006 + +BUGS +---- + - select from list open from UIChoice with exist value + - all list widget supports setValue/getValue + CLIP-UI ------- Index: form.prg =================================================================== RCS file: /cvsroot/eas-dev/clip-ui/form.prg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- form.prg 2 Jun 2006 14:12:09 -0000 1.1 +++ form.prg 18 Oct 2006 08:49:59 -0000 1.2 @@ -305,6 +305,9 @@ case "EDITCOLOR" o := UIEditColor() add = .T. + case "CHOICE" + o := UIChoice() + add := .T. case "CHECKBOX" o := UICheckBox(,label) add = .T. Index: special.prg =================================================================== RCS file: /cvsroot/eas-dev/clip-ui/special.prg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- special.prg 2 Jun 2006 14:12:09 -0000 1.1 +++ special.prg 18 Oct 2006 08:49:59 -0000 1.2 @@ -1,9 +1,9 @@ /*-------------------------------------------------------------------------*/ -/* This is a part of CLIP-UI library */ -/* */ -/* Copyright (C) 2004 by E/AS Software Foundation */ -/* Author: Andrey Cherepanov <sk...@ea...> */ -/* */ +/* This is a part of CLIP-UI library */ +/* */ +/* Copyright (C) 2004-2006 by E/AS Software Foundation */ +/* Author: Andrey Cherepanov <sk...@ea...> */ +/* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as */ /* published by the Free Software Foundation; either version 2 of the */ @@ -14,25 +14,40 @@ /* Choice class (edit box with button for choosing values) */ function UIChoice( action, value, text ) - local o := UIHBox(,0) - local obj := UIButton( "...", action, value ) - obj:layout := o - obj:edit := UIEdit( text ) - obj:edit:setReadOnly(.T.) - obj:className := "UIChoice" + local obj := UIEdit( text ) + obj:readOnly(.T.) + obj:button := UIButton( "...", action, value ) + obj:stick := map() + obj:stick:right := obj:button _recover_UICHOICE(obj) return obj function _recover_UICHOICE( obj ) - obj:setText := @ui_setText() - obj:getText := @ui_getText() + obj:setAction := @ui_setAction() + obj:setValue := @ui_setValue() + obj:getValue := @ui_getValue() return obj -/* Set text */ -static function ui_setText(self, text) - self:edit:setValue( text ) +/* Set action to UIChoice */ +static function ui_setAction(self, signal, action) + // Set action to choice button clicked + if signal=='clicked' .and. valtype(action)=='B' + self:button:setAction(signal, action) + endif return NIL -/* Get text */ -static function ui_getText(self) -return self:edit:getValue() +/* Set value */ +static function ui_setValue(self, value) + local v + if valtype(value) == 'A' .and. len(value) == 2 + driver:setValue( self, val2str(value[1]) ) + self:button:setValue(value[2]) + endif +return NIL + +/* Get value */ +static function ui_getValue(self) + local v:=array(2) + v[1] := driver:getValue( self ) + v[2] := self:button:getValue() +return v Index: table.prg =================================================================== RCS file: /cvsroot/eas-dev/clip-ui/table.prg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- table.prg 2 Jun 2006 14:12:09 -0000 1.1 +++ table.prg 18 Oct 2006 08:49:59 -0000 1.2 @@ -36,6 +36,7 @@ obj:clear := @ui_clear() obj:getSelection := @ui_getSelection() obj:getSelectionId := @ui_getSelectionId() + obj:getSelectionField := @ui_getSelectionField() obj:setAltRowColor := @ui_setAltRowColor() obj:savePosition := @ui_savePosition() obj:restorePosition := @ui_restorePosition() @@ -43,22 +44,23 @@ /* Add row and fill it by data */ static function ui_addRow(self, data, id) - local i, node + local i, node - // Fix missing id - if id == NIL - self:lastId++ - id := alltrim(str(self:lastId)) + // Fix missing id + if id == NIL + self:lastId++ + id := alltrim(str(self:lastId)) endif - // Convert values to strings + // Convert values to strings for i=1 to len(data) data[i] := val2str(data[i]) - next + next node := driver:addTableRow(self, data) node:className := "UITableItem" node:table := @self node:node_id := id + node:data := data self:nodes[node:id] = node return NIL @@ -91,7 +93,7 @@ sel := driver:getTableSelection( self ) return sel -/* Get current selection ID */ +/* Get ID of selected string */ static function ui_getSelectionId(self) local sel, id:=NIL sel := driver:getTableSelection( self ) @@ -103,6 +105,24 @@ endif return id +/* Get field value on selected string */ +static function ui_getSelectionField(self, column) + local sel, val:=NIL, node + column = iif(empty(column),1,int(val(column))) + sel := driver:getTableSelection( self ) + //?? "Selection:", sel, sel $ self:nodes, chr(10) + if .not. empty(sel) .and. sel $ self:nodes + node := self:nodes[sel] + ?? valtype(node:data), len(node:data), column, chr(10) + if valtype(node:data) == "A" .and. len(node:data) >= column .and. column > 0 + val := node:data[column] + //?? "Value:", val, chr(10) + endif + else + return NIL + endif +return val + /* Set alternate row color */ static function ui_setAltRowColor(self, color) self:altRowColor := UIColor(color) Index: window.prg =================================================================== RCS file: /cvsroot/eas-dev/clip-ui/window.prg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- window.prg 2 Jun 2006 14:12:09 -0000 1.1 +++ window.prg 18 Oct 2006 08:49:59 -0000 1.2 @@ -137,9 +137,12 @@ obj:setValues := @ui_setValues() obj:getValues := @ui_getValues() obj:return := @ui_return() + obj:select := @ui_select() obj:isChanged := @ui_isChanged() obj:setId := @ui_setId() obj:setFocus := @ui_setFocus() + obj:setPadding := @ui_setPadding() + obj:setSpacing := @ui_setSpacing() return obj function UIDocument(caption, parent, name) @@ -399,7 +402,7 @@ if valtype(o) != "O" .or. .not. "CLASSNAME" $ o return NIL endif - if ascan({"UIEdit","UIEditText","UIComboBox","UICheckBox","UIButton","UILabel","UIRadioButton","UISlider"},o:className) != 0 + if ascan({"UIEdit","UIEditText","UIComboBox","UICheckBox","UIButton","UILabel","UIRadioButton","UISlider","UITable","UITree","UISheet"},o:className) != 0 // Extract type from name nArr := split(name,':') @@ -433,7 +436,7 @@ local i, w, v, values := array(0) for i in self:valueNames w := self:value[i] - if at(i,"\.") == 0 .and. "GETVALUE" $ w // Only object's field + if at(i,"\.") == 0 .and. "GETVALUE" $ w .and. w:className != 'UIButton' // Only object's field, without buttons v := w:getValue() aadd(values, { i, v } ) endif @@ -465,9 +468,26 @@ /* Return values to another form */ static function ui_return(self, val) local act -// ?? "RETURN value:",valtype(val), val,"|", "RETURNACTION" $ self, valtype(self:returnAction), chr(10) + //?? "RETURN value:",valtype(val), val,"|", "RETURNACTION" $ self, valtype(self:returnAction), chr(10) + if "RETURNACTION" $ self .and. valtype(self:returnAction) == "B" + act := self:returnAction + eval(act, val) + endif +return NIL + +/* Return id and text from table to another form */ +static function ui_select(self, table, column) + local act, obj:=NIL, val:=array(2) + //?? "RETURN value:","RETURNACTION" $ self, valtype(self:returnAction), chr(10) if "RETURNACTION" $ self .and. valtype(self:returnAction) == "B" act := self:returnAction + obj := mapget(self:value, table, NIL) + //?? valtype(obj), "GETSELECTIONID" $ obj , "GETSELECTIONFIELD" $ obj, chr(10) + if .not. empty(obj) .and. "GETSELECTIONID" $ obj .and. "GETSELECTIONFIELD" $ obj + val[1] := obj:getSelectionField(column) + val[2] := obj:getSelectionId() + endif + //?? "RETURNED:", val,chr(10) eval(act, val) endif return NIL @@ -594,3 +614,17 @@ timer:stop() next return NIL + +/* Set window padding */ +static function ui_setPadding(self, padding) + if "USERSPACE" $ self + self:userSpace:setPadding( padding ) + endif +return NIL + +/* Set window spacing */ +static function ui_setspacing(self, spacing) + if "USERSPACE" $ self + self:userSpace:setspacing( spacing ) + endif +return NIL |