我需要在LiveCode DataGrid中創建一個字段編輯器,該字符編輯器隨着用戶鍵入以適合字段的格式化高度而增長。底層行控制的其餘部分需要隨着將任何後續行控件向下移動而調整大小。如何在LiveCode DataGrid中創建擴展字段編輯器?
0
A
回答
4
回答我自己的問題,因爲它可能對他人有用。
將字段編輯器行爲按鈕從revDataGridLibrary堆棧複製到具有行模板的卡上。
編輯字段的腳本編輯如下(注意,你將需要修復的行爲按鈕參考作爲新的領域edtior行爲的長期ID):
on preOpenFieldEditor pEditor
set the behavior of pEditor to the long id of button id 1023 of card id 1010 of stack "Data Grid Templates 1362091650635"
set the uRowControl of pEditor to the long id of the owner of me
end preOpenFieldEditor
編輯字段編輯器行爲腳本中加入以下內容:
local sHeight,sRowControl
setProp uRowControl pRowControl
put pRowControl into sRowControl
end uRowControl
on openField
put the formattedHeight of me into sHeight
pass openField
end openField
on textChanged
local tHeight,tRect
lock screen
put the formattedHeight of me into tHeight
if sHeight <> tHeight then
put the rect of me into tRect
put item 2 of tRect+ tHeight into item 4 of tRect
set the rect of me to tRect
put tHeight into sHeight
dispatch "UpdateRow" to sRowControl with the long id of me
end if
unlock screen
pass textChanged
end textChanged
現在編輯的行模板,行爲添加以下處理程序(注意,在這種情況下,現場正在編輯名爲「注意」,所以你會想改變您的使用情況) :
on UpdateRow pFieldEditor
set the rect of graphic "Background" of me to the rect of pFieldEditor
set the rect of fld "note" of me to the rect of pFieldEditor
set the rect of me to the formattedRect of me
put the uScriptLocal["sTableObjectsA"] of me into tTableObjectsA
repeat for each line tControl in tTableObjectsA["all row controls"]
delete word -2 to -1 of tControl -- of me
put tControl into tControlA[the dgIndex of tControl]
end repeat
put the bottomLeft of me into tTopLeft
repeat for each item tIndex in tTableObjectsA["current"]["indexes"]
if tIndex > the dgIndex of me then
set the topLeft of tControlA[tIndex] to tTopLeft
put the bottomLeft of tControlA[tIndex] into tTopLeft
end if
end repeat
end UpdateRow
0
看起來有用,蒙特。問題:爲什麼preOpenField處理程序?無法在設計時只設置一次該信息?每次調用編輯器時,DataGrid是否創建一個新的字段控件?
相關問題
- 1. 如何在新的VS2010編輯器可擴展性中創建編輯器選項
- 2. 如何擴展Atom編輯器與包
- 3. 擴展Visual Studio編輯器
- 4. 如何編輯Firefox擴展?
- 5. 爲DataGrid創建擴展方法=> AutoScroll?
- 6. DataGrid中的擴展器(Silverlight)
- 7. datagrid擴展器+ RowDetailsVisibilityChanged
- 8. Datagrid在創建,編輯頁面
- 9. 如何在silverlight 4 datagrid中創建可編輯的列標題?
- 10. 擴展的DataGrid ColumnHeaderStyle編程
- 11. 如何在SSIS中擴展查找轉換編輯器
- 12. 如何在媒體編輯器中自定義擴展名?
- 13. 如何在C#中創建擴展?
- 14. 如何在類中創建線程擴展片段
- 15. 如何從many2one字段中刪除創建和編輯...?
- 16. 如何創建Dreamweaver擴展?
- 17. 如何創建擴展MKMapView
- 18. 如何創建jinja2擴展?
- 19. 如何創建Devise擴展?
- 20. 我如何着手在Eclipse中創建編譯器/編輯器?
- 21. ASP.NET DataGrid和HoverMenu擴展器
- 22. 在WordPress管理員中創建「擴展生物」字段
- 23. 爲複選框字段創建編輯器裝飾器
- 24. xcode 8搜索編輯器擴展
- 25. 可擴展數據庫編輯器
- 26. Chrome擴展程序 - 編輯文本字段
- 27. Visual Studio:如何使用WPF編寫擴展編輯器
- 28. 如何在Word-VBA中創建超過255個字符的可編輯字段?
- 29. 如何在css中將編輯器標籤與編輯器字段對齊
- 30. 擴展DataGrid
我認爲它確實創造了飛行中的領域。無論哪種方式,編輯datagrid組內某個對象的屬性比動態設置屬性更爲複雜。 preOpenFieldEditor處理程序是設置字段編輯器屬性的文檔化方式。 – 2013-03-08 21:59:06