andyhill
-
Posts
1261 -
Joined
-
Last visited
-
Days Won
6
Content Type
Profiles
Forums
Events
Posts posted by andyhill
-
-
Can you please give me examples on how to add listeners with their appropriate parameters:-
"hide"
"boxready"
Thanks
-
I have many grids (grdSuppliers etc.) created at runtime and during their creation I set up some ExtEvents (BoxReady, Resize etc.), some work and some do not work.
In the past I have ignored but now tidying up my code - please advise how to get BoxReady and Hide to work - Thanks.
////////////////////////////////////////////////////////////////////////////// grdSuppliers.ClientEvents.ExtEvents.Clear; ////////////////////////////////////////////////////////////////////////////// // BoxReady: NEVER FIRES ? MyScript:= 'boxready=function boxready(sender, width, height, eOpts) '+ '{ '+ ' ajaxRequest(MainForm.grdSuppliers, ''_BoxReady_'', ["w="+width, "h="+height]); '+ '} '; grdSuppliers.ClientEvents.ExtEvents.Add(MyScript); ////////////////////////////////////////////////////////////////////////////// // Resize: FIRES MyScript:= 'resize=function resize(sender, width, height, oldWidth, oldHeight, eOpts) '+ '{ '+ ' ajaxRequest(MainForm.grdSuppliers, ''_Resize_'', ["w="+width, "h="+height, "oldw="+oldWidth, "oldh="+oldHeight]); '+ '} '; grdSuppliers.ClientEvents.ExtEvents.Add(MyScript); ////////////////////////////////////////////////////////////////////////////// // Hide: NEVER FIRES ? MyScript:= 'hide=function hide(sender, eOpts)'#10+ '{ '#10+ ' ajaxRequest(MainForm.grdSuppliers, ''_Hiding_'', []); '+ '} '; grdSuppliers.ClientEvents.ExtEvents.Add(MyScript); ////////////////////////////////////////////////////////////////////////////// // Show: FIRES MyScript:= 'show=function show(sender, eOpts)'#10+ '{ '#10+ ' ajaxRequest(MainForm.grdSuppliers, ''_Showing_'', []); '+ '} '; grdSuppliers.ClientEvents.ExtEvents.Add(MyScript);
-
I never use SLEEP, instead use ajaxrequest with delay.
...
UniSession.AddJS('Ext.defer(function() {ajaxRequest(MainForm.window, ''_SetFilter_'', [])}, 300);');
...procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings);
beginif SameText('_SetFilter_', EventName) then begin
...
-
Thanks Sherzod 🙂
-
grdWorkSheet.ClientEvents.UniEvents.Clear; MyScript:= 'pagingBar.afterCreate=function pagingBar.afterCreate(sender)'+ '{ '+ ' sender.add( '+ ' [ '+ ... ' { '+ ' xtype: ''tbseparator'' '+ ' }, '+ ' { '+ ' xtype: ''label'', '+ ' id: "gridLabelid", '+ ' text: ''abc'', '+ ' margin: ''0 0 0 10'', '+ ' }, '+ ' { '+ ' xtype: ''tbseparator'' '+ ' }, '+ ... ' ]); '+ '} '; grdWorkSheet.ClientEvents.UniEvents.Add(MyScript);
Above my FormCreate code adds a Label to the Pagingbar and it displays as expected (please advise if I have added the Label correctly).
Elsewhere I want to change the Label.Text value at runtime
grdWorkSheet.JSInterface.JSCode(#1'.pagingBar.getComponent("gridLabelid").setValue(''Andy'');');
SetValue fails, please advise how to change the "gridLabelid" - thanks.
-
From a coding point of view I can easily create the list, parse the list, reject matching words if necessary, BUT I did not want to type into my application all of the ugly words (plus I do not know them all, nor do I want to). It would have been nice to have an encrypted lookup to check questionable text against. Maybe I am old fashioned 🫣
eg.
if Obscene(UserText) then begin
ShowMessage('Obscenities are not tolerated - Aborting !');
end else begin
...
end;Yes I am sure there are URL offerings out there but I need to watch my pennies plus I am trying to limit URL services in my project.
What about a UniGUI Community project ?
-
That is a lot to ask, download and run many unknown EXE's (no code) ?
-
I am looking at USER input text (Supplier Names, Item Names, Customer Names etc...)
Thanks for the links - interesting.
-
I am happy to learn about what is out there, could we have a UniGUI solution in the future (less opportunities to be intercepted) ?
-
I searched the forum for a simple way to reject obscenities, are there any examples out there ?
-
Solved (timing issue)
- 1
-
TLedgerTypesForm = class(TUniForm)
...
procedure PromptLedgerType(Sender: TComponent; AResult: Integer; AText: string);
...procedure TLedgerTypesForm.btnProcessClick(Sender: TObject);
beginPrompt('Ledger Name:', '', mtInformation, mbOKCancel, PromptLedgerType); // Prompts as expected
...procedure TLedgerTypesForm.PromptLedgerType(Sender: TComponent; AResult: Integer; AText: string); // Never fires
begin
if AResult = mrOK then begin...
I cannot understand why PromptLedgerType is never called ? I believe all procedures are declared correctly - am I having a seniors moment - please advise - thanks.
-
-
My apologies Sherzod for using the wrong parameters I trust the others are correct.
-
When Grid shows no rows the user can still invoke ContextMenu, if Grid contains row(s) then my current coding below disables ContextMenu.
How do we prevent Grid ContextMenu with zero rows ? Please advise - thanks
////////////////////////////////////////////////////////////////////////////// // Before Container MyScript:= 'beforecontainercontextmenu=function beforecontainercontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 + '{ '#13#10 + ' e.preventDefault(); '#13#10 + '} '; grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript); // Container MyScript:= 'containercontextmenu=function containercontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 + '{ '#13#10 + ' e.preventDefault(); '#13#10 + '} '; grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript); // Row MyScript:= 'rowcontextmenu=function rowcontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 + '{ '#13#10 + ' e.preventDefault(); '#13#10 + '} '; grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript); // Before Cell MyScript:= 'beforecellcontextmenu=function beforecellcontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 + '{ '#13#10 + ' e.preventDefault(); '#13#10 + '} '; grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript); // Cell MyScript:= 'cellcontextmenu=function cellcontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 + '{ '#13#10 + ' e.preventDefault(); '#13#10 + '} '; grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript); // Before Item MyScript:= 'beforeitemcontextmenu=function beforeitemcontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 + '{ '#13#10 + ' e.preventDefault(); '#13#10 + '} '; grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript); // Item MyScript:= 'itemcontextmenu=function itemcontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 + '{ '#13#10 + ' e.preventDefault(); '#13#10 + '} '; grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript); // Header MyScript:= 'headercontextmenu=function headercontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 + '{ '#13#10 + ' e.preventDefault(); '#13#10 + '} '; grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript);
-
All good Sherzod, I was searching under "local storage" instead of "localstorage".
- 1
-
Any progress Sherzod ?
-
Desktop, testing with Chrome
-
If it helps it is Desktop
-
I have followed instructions published on this forum but cannot fetch (get) the token 'BB' value which clearly exists in the Chrome Browser ?
Str:= '';
with edtStore.JSInterface do
JSCall('setValue', [jsstatement('localStorage.getItem("BB")')]);
Str:= Trim(edtStore.Text);
Please advise - thanks
-
Can we please have a project wide solution to stop Browser "Save Password" prompt that pops up at all odd times, not even related to the current non-password editor.
Something we can add to the MainForm.Script that will work across all editing - a Sencha solution.
Individually manipulating each edit as mentioned on other Internet posts is not practical.
-
Using port 80
Your HtmlMemo Component fails to add necessary tags to inserted images:-
"id"
"width"
"height"
to name a few.
My primitive work around is attached, please paste an image (view source [tags missing]), DblClick inserted image again shows "id" missing.
Please advise how to resolve.
Ultimately all images in HtmlMemo need the function of grabbing and resizing buy the end user.
-
OK, "id" now assigned.
How do I get the "width" and "height"
// Ctrl+V Paste
' sender.iframeEl.dom.contentDocument.body.addEventListener(''paste'', function(e) '+
' { '+
' var items = e.clipboardData.items; '+
' if(items.length === 1) '+
' { '+
' var str = items[0].type; '+
' if(str.indexOf("image") !== -1) '+
' { '+
' ajaxRequest('+MyJsName+', ''_PasteBefore_'', []); '+ I WANT TO SEND "ID", "WIDTH" & "HEIGHT" in params here
' } '+
' } '+
' else '+ // More or Less than one
' { '+
' e.preventDefault(); '+ // Kill Paste
' } '+
' }); '+// Create Image
' function createImage(source) '+
' { '+
' var pastedImage = new Image(); '+
' pastedImage.onload = function() '+
' { '+
// Add Unique "id"
' pastedImage.id = Ext.id(); '+// DO I NEED WIDTH and HEIGHT attributes recorded with image here
' }; '+
' pastedImage.src = source; '+
' } '+
-
I have played with all sorts of concepts (bypassing stretch handles for now using DblClick to investigate the selected pasted image [if one uses Ctrl+V to paste image there is no "id" added to the <img tag ???]):-
MyJsName:= htm001.JSName;
htm001.ClientEvents.ExtEvents.Clear;
MyScript:= 'initialize=function initialize(sender, eOpts) '+
'{ '+// DblClick
' sender.getDoc().addEventListener(''dblclick'', function() '+
' { '+
' if (arguments[0].target && arguments[0].target.tagName.toLowerCase()==''img'') '+
' { '+
' ajaxRequest('+MyJsName+', ''_img_'', ["id="+arguments[0].target.getAttribute(''id'')]); '+
' } '+
' }); '+// Ctrl+V Paste
' sender.iframeEl.dom.contentDocument.body.addEventListener(''paste'', function(e) '+
' { '+
' var items = e.clipboardData.items; '+
' if(items.length === 1) '+
' { '+
' var str = items[0].type; '+
' if(str.indexOf("image") !== -1) '+
' { '+
' ajaxRequest('+MyJsName+', ''_PasteBefore_'', []); '+
' } '+
' } '+
' else '+ // More or Less than one object
' { '+
' e.preventDefault(); '+ // Kill Paste
' } '+
' }); '+// Create Image
' function createImage(source) '+
' { '+
' var pastedImage = new Image(); '+
' pastedImage.onload = function() '+
' { '+
// Need To Add "id" to image here - please show how to make "id" unique
' }; '+
' pastedImage.src = source; '+
//' alert(pastedImage.src); '+
' } '+'} ';
htm001.ClientEvents.ExtEvents.Add(MyScript);
Sherzod, while you are investigating Stretch Handles, please show me how to add unique "id" to pasted image - Thanks
DBGrid, Extended Events - some events not firing ?
in General
Posted
I am after the same parameters as above:-
"boxready" sender, width, height, eOpts
"hide" sender, eOpts