Jump to content

Daryl McMurray

uniGUI Subscriber
  • Posts

    30
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Daryl McMurray

  1. Haven't been back here for a while... Was looking at getting back into UniGui with all the amazing updates - Wondering if anyone is actually still using my UniClientEvents Property edtior - should I continue to post updates/changes?
  2. Thanks Farshad - I had actually looked into that for Andy as well... on my samsung phone, using chrome, this does indeed handle the case of the user hitting back button (though not consistently), but it doesn't help with closing the tab or browser ... I don't believe this is possible as the browser doesn't support it. UniGui can only do so much. And it makes sense... Giving an app or a website the power to not shut down when the user is instructing it to, intentionally or otherwise, is too much power. Maybe just have a warning on your main or login screen that doing so may result in lost data.
  3. Hi again Andy - I've done some digging... it looks like you may be out out of luck on this one... It seems that in the early days of the onbeforeunload implementation, it worked exactly like you would expect, but after constant abuse from unfriendly websites that would try to trap the user into staying on their page and hit them with popups, it was altered greatly, and not in the same way on every browser. see: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload "Since 25 May 2011, the HTML5 specification states that calls to window.alert(), window.confirm(), and window.prompt() methods may be ignored during this event. See the HTML5 specification for more details. Note also, that various browsers ignore the result of the event and do not ask the user for confirmation at all. The document will always be unloaded automatically. Firefox has a switch named dom.disable_beforeunload in about:config to enable this behaviour." Basically, if the browser supports it at all, then it will most likely ignore anything you do in the event, display its own prompt to the user and only act on the result provided by hard user input. I believe the mobile browsers for the most part ignore the event. UniGui can only do what the browsers will allow. Sorry. - As a developer who understands the desire to provide users with a safety net from accidentally closing the browser/tab and loosing data, I am saddened, but I do understand the reason it was altered.
  4. Hi Andy - The TUnimForm (Mobile Form) does not have a script property, but you can accomplish the same effect by adding an event handler for the window.afterCreate event in the ClientEvents->UniEvents list. function window.afterCreate(sender) { window.onbeforeunload = function () { return ''; }; }
  5. No problem - I put it up here so that people could use it - I'm glad that people are interested. Please let me know how it works for you, and if you find any other issues.
  6. I've solved it. For interest sake... First, the System.ImageList was left over in my uses from something I had been trying and was no longer needed... I've removed it. Second, the AddPair method of the Tstrings object doesn't exist in in XE5 - so I just replaced the call with: LocalClientEvents.ExtEvents.Add(EventItem.EventName + '=' + EventItem.EventPrototype); And lastly, if you had gotten past that, you would still had an error because I've learned that in XE5, you can not use a #0 as a quotechar in a Tstrings for delimitedtext. You can find the new version here -> UniClientEventsPropEditor.zip I have also updated the original post to contain the corrected code. Thank you Mika for your feedback.
  7. Hi Mika - it looks like there are some parts of the editor that XE5 doesn't like. I'm working on it and will post here when I've got it corrected.
  8. I can do this by modifying the picture property only at design time... but it seems the "Incorrect" way to do it. I would much rather do it properly and use VCLControlClassName method override. Does anyone know how this system works???
  9. OK... I'm actually trying to build this component (TUniMappedImage) With a property editor to visually define hotspot areas (rect, circle and poly) I'm descending from TUniImage - In Designer, I'd like to be able to visually show the hotspots, draw them on the canvas... I don't want to do this at all for the runtime web version... I know that UniGui is designed to separate design from runtime but... How do I use the VCLControlClassName method override to supply a designer only version for display? I can see that TUniImage uses "TVCLImage" which I assume does the painting for the design time display of the component... but I don't have the source for that class to be able to create a descendant. I've tried creating a new vcl class descended from TImage (in the same unit) and using that in a VCLControlClassName override method but it does not seem to work. Any ideas?
  10. I have finished and uploaded the new editor: http://forums.unigui.com/index.php?/topic/10113-property-editor-for-tuniclientevents/
  11. I have created a new property editor for the UniGui TUniClientEvents property in UniGui Controls. This is a single editor that can edit both the ext JS Events and the Uni JS Events for any UniGui component, form or frame. Main features: - Only displays the events for which a handler has been created - no more scrolling when you just want to modify an existing event. - All extJS events can be added for all JSObjects of a given component. Quick filter for finding possible events. - Non Modal - you can have multiple editors open for different UniGui components/forms/frames at the same time and Copy / Paste between them. - adds existing events to the context menu (Right click) in IDE so you can instantly jump to any existing event for a given component and begin editing. - allows access to original editors supplied with UniGui via button or context menu. History: When working with UniGui, I found I was spending a lot of time searching through JS event lists to find the one or two that I was using and needed to edit or tweak. I also found it unproductive to have to keep closing one editor to open and work with the events of another as I was often copying JS code from multiple events of one component to another. This editor is the result of my efforts to improve the productivity of this amazing framework. If any of you find this useful, please let me know. I have been using it exclusively for a few weeks now and believe it to be bug free. All feedback is appreciated. Updated March 1, 2018 - Corrected issues with using in XE5 (Thank you @mika). Included Package projects for Delphi versions (Thank you ) UniClientEventsPropEditor.zip
  12. What would really work would be an extended TUniImage that supports the addition of the "usemap" attribute and the addition of a HTML Map tag with Areas. I've figured out how to manually add this to a TUniImage: function afterrender(sender, eOpts) { document.getElementById(sender.el.id).getElementsByTagName('img')[0].setAttribute("usemap","#ImageMap"); document.getElementById(sender.el.id).innerHTML = document.getElementById(sender.el.id).innerHTML + ' <map name="ImageMap"> <area shape="rect" coords="0,0,82,126" href="#"> </map> '; document.getElementById(sender.el.id).getElementsByTagName('map')[0].getElementsByTagName('area')[0].onclick=function() { window.alert('clicked'); return false; // returning false stops the link being followed } } It wouldn't be too hard to create a TUniImage descendant that could store a hotspot list (rectangles, circles and poly) and fire an event. The time consuming part would be building a hotspot property editor to visually build the hotspot list. I'll add it to my ToDo List
  13. Thank you gerardocrisci - I just tried your updated component, but it still has the flaw I described in my post. If you use your combobox to change the dataset value, but then cancel the change (dataset.cancel) instead of post, the component should switch back to showing the original value that it started with to match the dataset. Yours does not do this. It will continue to show the newly selected value even though it does not now match what is in the dataset. If you make the change I suggested, or some variation of it, it will reset to the correct value as it should. There is a similar flaw that occurs when the component is connected to an empty dataset, a record is inserted or appended, and then then canceled. Like with the changed record, it keeps the new value instead of going blank like it should for an empty dataset. To fix that, add the following code AFTER the Text := Value; in the DataChange Method. if datalink.Field <> nil then begin if datalink.Field.IsNull then begin InternalText := '1'; text := ''; end; end; With those changes, I have made very good use of your component in several projects and I thank you again for your original work. Cheers!
  14. This is easy to do... UniApplication.Terminate('GoodBye'); // to put the app in a closed state in the browser PostThreadMessage(MainThreadID,wm_quit,0,0); // will tell the main application to terminate
  15. There is a much cleaner way to do this... ExitProcess(0); will terminate the application without proper shutdown... Use: UniApplication.Terminate('GoodBye'); // to put the app in a closed state in the browser PostThreadMessage(MainThreadID,wm_quit,0,0); // will tell the main application to terminate Use only for testing though... or users will be able to terminate the server.exe
  16. Yes there is - UniApplication.Terminate('GoodBye'); // to put the app in a closed state in the browser PostThreadMessage(MainThreadID,wm_quit,0,0); // will tell the main application to terminate Use only for testing though... or users will be able to terminate the server.exe
  17. try this UniApplication.Terminate('GoodBye'); // to put the app in a closed state in the browser PostThreadMessage(MainThreadID,wm_quit,0,0); // will tell the main application to terminate Use only for testing though... or users will be able to terminate the server.exe
  18. I believe I have found them! It's going to take some time to code though... I have to access the JSObjects array of a given component (which is protected)... and then locate the correct Resource String in the ExtJS.RES file, parse that out for the events, and then construct a JSfunction prototype... Here goes
  19. I discovered a small flaw in the component from @gerardocrisci... if you change the item in the list but cancel the edit (call TDataset.Cancel), the component does not refresh and revert back to the previous value as stored in the table. It will continue to show the new selected item from the list. You can fix this by inserting: if DataLink.Editing = false then begin InternalText := value+'1'; // gives reason to send change back to browser. end; before Text := Value; in the DataChange Method. I tried to attached a fixed version but the form won't let me... - Thank you so much @gerardocrisci for your original component and work.
  20. Hi Andy - Yes, I will share my code for the editor once I have tested it a bit more under fire. I will post it to the "Components and Code Samples" form and notify here that I have done so. I would really like to be able to use it to add Client Events too though... does anyone know where the component ClientEvents possibilities list comes from? I'm hoping they are not just stored in the ClientEvents Property editor.
  21. I am trying to find out how to access the list of possible ClientEvents javascript events for a given UniGui Control. How does the ClientEvents property editor know what they are? I am building a more functional Property editor for ClientEvents - I find I spend a lot of time searching through js events that I don't care about to get to the ones I've already initiated and just want to tweak. I've created an editor that adds to the context menu (right Click Menu) in the IDE and lists all the existing js events (Ext and Uni) and then can take you directly to that event for editing. Once the editor is up, you can also quickly get to all other existing events for both Ext and Uni - I have also made this editor non modal so that you can have several open at a time and switch between them and the form editor and code. (I also spend a lot of time opening the ClientEvents editor, finding an event, copying some code, closing it then going to another component, opening its ClientEvents editor, finding an event and pasting code.) This now lets me copy and paste js code bits easily from one component to any other. I have also added an "Apply" changes function so that I can save the change back to the component and run/test the project without having to close the editor. The only thing stopping me from replacing the default ClientEvents property editor is that I can not figure out how to get the list of all possible events for a given component class. So, I can edit existing ones that were created with the default editor, but I can't properly Add New ones... I've searched through all the source code that came with my purchased version, but I have either missed where the possible js event names come from, or it isn't included. For now, I just have a button that launches the default editor for me so I can add an event and then return to my simplified editor. Any thoughts? I'd be happy to post and share my finished editor here - it is all contained in a single form file and easy to install. I've included some images to show how it works/looks.
  22. I've discovered another minor issue... the TUniDBDateTimePicker component does not initialize to readonly when the dataset.autoedit property is set to false. once you edit and then cancel or post the recordset, then it behaves properly, but on creation in the browser, it always starts in editing mode. I have fixed this on my system by adding the line SetJSReadOnly(InternalReadOnly); to the end of the TUniCustomDBDateTimePicker.LoadCompleted procedure. I'm not sure if that is where you would correct the problem but it seems to work now. Thank you.
  23. Yes, sorry - I am now on build 1424 - the problem is still there. I have developed a workaround however... Attached to the grid... function cellkeydown(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) { if (e.keyCode==32){ if (sender.getGridColumns()[cellIndex].checkColumn){ td.firstElementChild.firstElementChild.firstElementChild.onclick(); } } } I will use this for now, but I believe it should be built in as not having keyboard support for checkbox columns really messes up data entry flow. I have also noticed that the grid does not adhere to the TDataSource.AutoEdit Property. I usually make data entry fields require an explicit dataset.edit before allowing changes to be made so that data doesn't get changed accidentally by users. Lastly, I'm sorry that my first form comment is to deal with issues - So, I would also like to say THANK YOU - for all of your hard work on this framework. For a Delphi Developer, it really is an amazing tool and so powerful. I can see that you are constantly improving it, and your attention and response to this form, your customers, and even only potential customers, is outstanding!
  24. Not sure if I'm missing a property or something here... I have a TuniDBGrid with several boolean columns. With the grid in edit mode, I can edit the text columns starting with the first, and tab to the next one which is automatically in edit mode... all is good... until I get to a checkbox column. It gets selected, but there doesn't seem to be any way to toggle the checked value using the keyboard. I expect space bar to work, but it does not. Only way to check the box seems to be to have to reach over and used the mouse to click on it. My application is almost purely data entry, row after row, and so this would be a big annoyance. I've tried everything I can think of. Can not use a TUniCheckBox as a column editor, and it doesn't work in RowEditor Mode either (in fact that is much worse as the tabOrder is all screwed up) Thoughts? Using version 1.0.0.1407 professional paid. A little more information... the "beforeedit" js event is not being fired on the checkbox column. So it looks like the grid just never puts the cell into edit mode. Edit- Nope - tried this in the cellKeyDown... function cellkeydown(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) { // only fire on F4 if (e.keyCode==115){ ed=sender.getSelectionModel().getCurrentPosition(); sender.editingPlugin.startEdit(ed.row, ed.column); } } the startedit function returns true and puts the cell into edit mode for all columns except the check box column... for that, it returns false and does nothing.
×
×
  • Create New...