Jump to content

Daryl McMurray

uniGUI Subscriber
  • Posts

    30
  • Joined

  • Last visited

  • Days Won

    3

Daryl McMurray last won the day on April 4 2018

Daryl McMurray had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    Ontario, Canada
  • Interests
    Gymnastics, Electronics, Software Development

Recent Profile Visitors

883 profile views

Daryl McMurray's Achievements

Newbie

Newbie (1/4)

10

Reputation

  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
×
×
  • Create New...