Jump to content

softtouch

Members
  • Content Count

    181
  • Joined

  • Last visited

Everything posted by softtouch

  1. softtouch

    Listview prevent change of item

    I have a listview (report mode) and a memo. The listview has items, when an itrem is clicked, the memo is filled with some data related to the listview item. When the data in the memo is changed/modified, and the user click on another listciew item or the empty space in the listview, I want to popup a messagebox telling the user about the modification and if he want to continue. If he select to not to continue, I want that the listview does not change the item. Unforetunately, onSelectItem with a messagebox in it wont work, its called twice. onChanging also is called twice, even I set AllowChange to false. So how can I have a messagbox in any of the event without it being called twice?
  2. softtouch

    Listview prevent change of item

    Thank you for the detailed information. I decided to go with a virtualstringtree, and that seems to work as expected.
  3. softtouch

    Listview prevent change of item

    That is what it is currently doing, but user complain that they lost lots of changes because they forgot to click that button. I am now playing with the virtualtreeview, that seems to work better.
  4. I have a script, and when calling python.ExecFile(script), it will take 235ms to execute. Calling it the 2nd. or more times, it always takes a little more than 4 seconds to come back from the ExecFile function. Do you have any clue why that could be? Is there anything to reset something before calling the ExecFile again I need to know about?
  5. softtouch

    Readin Email with IMAP component

    I tried it and it seems to work. I assume if I have multiple "NOT" criteria, I need to do it like this? sr[0].key:=skNot; sr[1].key:='skBody; sr[1].text:='This should not be in the body'; sr[2].key:='skBody; sr[2].text:='This should also not be in the body'; So when it see the skNot, it will use only the next criteria for the skNot or until it get another sk??? criteria?
  6. softtouch

    Readin Email with IMAP component

    @Remy Lebeau, to not to open a new thread, because my question is related: When I want to get emails when a specific text exist in the body, and another text does not exist, can I do it like this? SetLength(sr,3); sr[0].key:=skNot; sr[1].key:=skBody; sr[1].text:='This should not be in the body'; sr[2].key:=skBody; sr[2].text:='This must be in th ebody';
  7. softtouch

    Free profiler?

    I am looking for a (free) profiler for Delphi 12. I am interested to know how long the execution of various procedures and functions will take. Because there are hundreds of such procedures/functions, I cannot just insert dome gettickcount code, that would take forever.
  8. softtouch

    RAD Studio 12.1 Athens Patch 1 Available

    The patch is available via getit, I just installed it.
  9. softtouch

    TComboBoxEx icon in editbox?

    I have a TComboBoxEx with items in it. Each item has an icon assigned, so far so good. When I click into the editbox to enter a new item name, there is no icon of course, but instead a weird space to the left (see attached image). Is there any way to have a default icon displayed in the editbox of the TComboBoxEx?
  10. softtouch

    If command

    ... the :='True' should be ='True'...
  11. softtouch

    Delphi 12.1 is available

    Yes, that will just return "We couldn’t find any requests"
  12. softtouch

    Delphi 12.1 is available

    Just wanted to read and comment on it, but that weird new portal does not list any report for me.
  13. softtouch

    Delphi 12.1 is available

    It uninstalled my 12 update 1 version and I had to reinstall all components again 😞
  14. Lets say I have an array with the following 2 strings in it: ClickElement_ByXPATH ClickElement_ByCSSSelector I have Python function with the same name, so I could call MainModule.ClickElement_ByXPATH or MainModule.ClickElement_ByCSSSelector, which works. Is there any way to create the funcname in the call MainModule.<funcname> based on the strings in the stringlist? For example, when I get the first item in the stringlist (ClickElement_ByXPATH), how could I create a call to MainModule.<here the element from the stringlist>, similar I can do with rtti and delphi functions, so it would call MainModule.ClickElement_ByXPATH? With other words, creating the call based on the text in a stringlist.
  15. softtouch

    mainmodule.<functionname> dynamically?

    Thank you! This is actually working just fine!
  16. softtouch

    mainmodule.<functionname> dynamically?

    I did, but I cant get it to work unfortunately. Anyway, thanks for your help.
  17. softtouch

    mainmodule.<functionname> dynamically?

    Thank you, but how can I provide parameter to the call when using this approach like result:=MainModule.ClickElement_ByXPATH(param1,param2,param3...)
  18. softtouch

    mainmodule.<functionname> dynamically?

    Via MainModule.<pythonfunction name here> (TPythonModule of P4D) If the python function ClickElement_ByXPATH exist, I call it like MainModule.ClickElement_ByXPATH();
  19. softtouch

    mainmodule.<functionname> dynamically?

    I want to call python functions. Their names are in a stringlist. With other words, how could I call a python function when the function name is a string? Example: var s:='ClickElement_ByXPATH'; How can I call the corresponding python function, which has exactly that name?
  20. I have a listview with groups and items. User can drag/drop items between groups. But when they move the last item of a group to another group, that group become invisible, so they cant move items back to that group. Is there any way to keep groups visible at all time, even they have no items assigned to them?
  21. I just set DefaultDraw to false in onCustomDrawItem for that dummy item, and I have now the group header with an invisible item and no checkbox for that, so thats all fine so far.
  22. Thanks for the hint with the blank item. Now I just need to find a way to hide the checkbox for that blank item.
  23. I create a TPythonModule, and add a delphi methode in the OnInitialization event of the module with TPythonModule(Sender).AddDelphiMethod('....') to it. If I dont call the method from Python, module.free is instantly, but once I have called this delphi method, even the method does noting, it takes a couple of seconds for module.free to return. Is there something I need to do to prevent this delay?
  24. softtouch

    Freeing TPythonModule after using it takes long

    Sorry for the late replay. I believe I found the issue, its related to selenium somehow. Once I use selenium, freeing the module takes 5 seconds, even the selenium driver was already closed earlier.
  25. softtouch

    Freeing TPythonModule after using it takes long

    A minimum example, which works just fine but cause the delay, and I cant figure out why that is. In form create: procedure TfrmTest.FormCreate(Sender: TObject); begin eng:=TPythonEngine.Create(nil); eng.DllName:='python312.dll'; eng.DllPath:=pythonhome; module:=TPythonModule.Create(nil); module.Engine:=eng; module.ModuleName:='delphicallback'; module.OnInitialization:=InitPythonModule; eng.LoadDll; end; In form close: procedure TfrmTest.FormClose(Sender: TObject; var Action: TCloseAction); begin eng.Free; // Takes 5 seconds to return once the python script called the delphi method end; The InitPythonModule has just this one line: procedure TfrmTest.InitPythonModule(Sender: TObject); begin TPythonModule(Sender).AddDelphiMethod('callback',delphi_callback,'callback(name, value)->value'); end; The delphi method "delphi_callback" only does this for testing: function TfrmTest.delphi_callback(pself, args: PPyObject): PPyObject; var key:pansichar; value:PPyObject; begin with GetPythonEngine do begin if PyArg_ParseTuple(args, 'sO:callback', @key, @value) <> 0 then begin result:=PyUnicodeFromString('Test'); end; end; end; Calling the python script procedure Tfrmtest.btntestClick(Sender: TObject); begin eng.ExecFile(<the script file path here>); s:=MainModule.Test('Hello world'); end; The python script does this for testing: import delphicallback def Test(s:str)->str: delphicallback.callback('testing',s)
×