Jump to content

Dao

uniGUI Subscriber
  • Posts

    18
  • Joined

  • Last visited

Everything posted by Dao

  1. My thanks to both of you, I'll try to insert this into my working project.
  2. How? In the same event? What parameters do you call?
  3. Hello! So I have now put my JS code in my grid: Ext Event --> cellClick and my console.log does get the icon clicked. But now, how do you call a Delphi/Unigui component from JavaScript? function cellclick(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) { const noteIcons = document.querySelectorAll('.note'); //icons repeat themselves const heartIcons = document.querySelectorAll('.heart'); for(noteIcon of noteIcons){ noteIcon.addEventListener('click', function(ev){ console.log('clicked on note'); //I want to call my form1 here, sth like //Form1.Show; }) } for(heartIcon of heartIcons) { heartIcon.addEventListener('click', function(ev){ console.log('clicked on heart'); //I want to call my form2 here, sth like //Form2.Show }) } Everything I've tried got me an "undefined" Attached, a very simplified version of what I'm trying to do if it can help. test_JS.zip
  4. But how do you manage to indicate that you clicked on ONE specific icon, not on the entire cell as a whole? How do I make it "read" inside the cell to get the different IDs and see which one was clicked? EDIT: I'm testing a different approach than OnSelectEvent in Delphi and trying to go now by Ext Event -> cellclick, I will update after this. So far it seems to be better but once my event was capture and I get my icon, how do I call it in the Delphi code in my form?
  5. Hello Sherzod, I'm currently using a "onSelectCellEvent", but I can't manage to get the icons separately. So right now a click detects the cell as a whole. I have given a different id to my icons and I'm looking for something equivalent to this in Vanilla JS: //Note icon document.querySelector('#icon1').addEventListener('click', () => {//open window A}); //Heart icon document.querySelector('#icon2').addEventListener('click', () => {//open window B}); Is a similar approach possible? Or do I need to consider it differently? Thanks!
  6. Hello! I'd like to know if you can split a cell in a uniStringGrid and to give each part a specific behaviour. The idea is that I have two icons in the same cell: Clicking on the note icon should lead to one window, while clicking the heart icon should lead to another, different one. Is it possible to achieve this in one cell, or do I need to obligatory have several columns? Thank you for your help.
  7. Hi Sherzod. Don't what happened but the error doesn't pop up anymore. Thanks for your help! Is there any "official" doc regarding these kind of functions, like how do you build them? I see some examples here and there on the forums but I find myself unable to customize them because I can't find it documented anywhere...
  8. Thank you @Sherzod. Tried it, but I get an Ajax error when trying to implement your code: Also if I may ask: how do you know what JS action to call? I've been trying with JSAssign/JSCall, and I see that you've gone to another approach with JSCall/JSCallDefer.
  9. It's done. Any ideas for my layout resizing issue? Thanks
  10. Sure: Professional edition, uni-1.90.0.1549
  11. Hello! Is there any way to change the layout of a panel when the screen becomes smaller? I have a panel in my form whose layout is hbox. When my window size is 800px, I'd like the layout to set to vbox. I've tried something like: procedure TMainForm.UniFormScreenResize(Sender: TObject; AWidth, AHeight: Integer); begin if Awidth < 800 begin mypanel.layout := 'vbox'; //other layout adjustements end; end; But to no success. Do I have to do this with JS? If yes, how? I have also tried something like mypanel.jsInterface.jsAssign('layout', ['vbox']); //(also tried 'type' instead of 'layout') mypanel.jsInterface.jsCall('updateLayout, []); //also tried doLayout instead of updateLayout But it gives an error. Visually, I'm trying to achieve a layout like this: Thanks!
  12. Dao

    Config Option error

    No, I'm really trying to keep it as simple as possible and I'm currently not using any JS, just playing with the Design
  13. Dao

    Config Option error

    No, it's my own form
  14. Dao

    Config Option error

    I'm playing with alignment and layout properties to test how they work and how they render on browser, because I want my app to be responsive (I've posted about this particular issue here http://forums.unigui.com/index.php?/topic/17018-mainform-resizing-to-screen-width-responsiveness/) For this I'm modifying Layout/ Layout Config / Layout Attribs properties of my form and sometimes gets the shown "Config option" error, that's why I think it could be the trigger but I don't know how to prevent it.
  15. Dao

    Config Option error

    Another one of those errors appeared, and after a few manipulations, I suspect it may come from changing width and height in Layout Config -> width: 100%, height: 100% (this is to achieve resizing of screen to 100% but I don't know if it's the right way, as per another I made today) Any opinion? Thank you!
  16. Dao

    Config Option error

    Hi, I'm fairly new to unigui and I don't even know what these config options refer to... Where can this config can be accessed?
  17. Hello! It's the 3rd time I get this error: https://imgur.com/2QOpPnk First time, I don't what happened. Second time was this morning, I was only trying to play with alignment properties of my form. Despite reverting the changes, the error was still there. Third time, same scenario. Moreover, the error happens when I click on another form that I wasn't working on. Any ideas where this can come from? It's very annoying because once it's here, I can't manage to revert to a version that works. Thank you! In case image doesn't display, the error says: Config Option: O47 -> items:[O8]<br/> is refering a previous request, <br/> it's not allowed in AJAX request of JS handler. <br/> Use equivalent public Property or Method instead.
  18. Hello! I'm new to Unigui and despite reading similar topics, I can't manage to get it work the way I want. I currently have a simple web app: my main form consist of two panels (one with 2 buttons and a date picker) and a string grid. The WindowState of MainForm is set to wsMaximized. First opening of the browser does work: the app is browser-window sized. But if I change the size of the window with the mouse, or use minimize/maximize window button, it stays the size it was first opened. The questions are: 1. How do I manage to have my app ALWAYS resized to the screen size? Is it managed by Delphi code (onResize) or do I need to go into the JS (window.resize)? Or both? I've seen a few sample codes here and there but I don't understand where they should be implemented and how they relate to each other, if at all.. 1b. Could the only use of the Layout (attribs/config) options work for this ? 2. What about the responsiveness of elements inside the form? In other languages, that's where I use media queries within the CSS but it doesn't work here. 2b. Can you actually change the CSS of existing unigui components ? I've tried to do so in the ServerModule -> CustomCSS but without success. I'd really appreciate any help you can provide with this. Please let me know if something is unclear. Thanks!
×
×
  • Create New...