Jump to content

JohnLM

Members
  • Content Count

    218
  • Joined

  • Last visited

Posts posted by JohnLM


  1. The purpose of using this API is for pulling just the "artist release date". I am not using the REST that comes with Delphi yet, but I probably should and will eventually.  I just need the artist release date for now. And I can pull that info from the JSON.

     

    https://www.discogs.com/developers/#page:database,header:database-search-get

     

    But. . . I'm having trouble trying to test the demo.  I have the two keys they sent, but the guide(s) I am reading do not include the whole API string, and its confusing.  I've never had this much difficulty with API's. 

     

    I need to format the "fetch" part (below) into a full one-line string that I can paste into the URL box in a webbrowser. 

     

    fetch('https://api.discogs.com/releases/1', {
      headers: { 'Authorization': 'Discogs key=[YOUR_KEY],secret=[YOUR_SECRET]' }
    })
      .then(response => response.json())
      .then(data => console.log(data))
      .catch(error => console.error(error));

     


  2. As I mentioned in my previous response, the code snippet I provided is buggy and will not work for every case, and definitely not for a larger list of items, so I do not recommend it. 

     

    As for a solution, I don't have the TMS component you mentioned, so I don't know what it can/cannot filter as you stated. 

     

    For your request, it will require a more custom algorithm for that type of filter search to make it work the way you want.  And for that, you will have to figure that part out or search google for one if one exists. 


  3. Quote

    and If in EditBox I Enter z or x , listbox gets cleared , how to solve this

     

    I played around with this myself and came up with the following that works for me: 

     

    procedure TForm1.Edit1Change(Sender: TObject);
    Var
      i: Integer;
    Begin
      if trim(Edit1.text)='' then
        listbox1.items.Assign(list_global)
      else begin
        for i := 0 to list_global.Count - 1 do
          if pos(Edit1.text, list_global[i]) > 0 then begin
            listbox1.Clear;
            listBox1.Items.Add(list_global[i]);
          end;
      end;
    End;

    If any items in the listbox starting with the first char of those items, those item(s) will show in the listbox. 

    Sometimes other items will show if having the same char.

    And, other times will not. In other words, its a little buggy. 

     


  4. Well, I added to the Public section.  I made sure that it was still working (the process), and then I removed that TButton, btn.  I was going to hide the button if I was still going to use it. But now that I am no longer using it, I don't have to hide it.

     

    Public
      procedure ImageClick(Sender: TObject);

     


  5. @Stano -- and your solution works, thanks. 

     

    procedure TForm1.btnClick(Sender: TObject);
    begin
      if Sender is TImage then begin
        var Im := TImage(Sender);
        eb1.Text := im.tag.ToString;
        case Im.tag of
          1: begin end;
          2: beep;      // IM_2 was clicked, so produce a audible tone
          3: begin end;
        end;
      end;
    end;

     


  6. re building an custom event, or crude wrapper event. . . 

     

    I have an idea that might work but it requires me to add an additional parameter to an event for the TButton, recall I gave it the name, 'btn'. 

     

    Normally, the .onclick event looks like this: 

     

    procedure TForm1.btnClick(Sender: TObject);
    begin
    end;

    To get my idea to possibly work, I will need to add an additional parameter to this, thus making it now look like this: 

     

    procedure TForm1.btnClick(Sender: TObject; _tag: integer);
    begin
    end;

    Then, I will write the following code:

     

    procedure TForm1.btnClick(Sender: TObject; _tag: integer);
    begin
      with TImage(Form1.FindComponent('IM_' + inttostr(_tag))) do begin
        beep;
        // show the imagelist's image that was clicked on, in the main image. 
        image1.picture.assign( TImage(Form1.FindComponent('IM_' + inttostr(_tag))) );
      end;
    end

    ...as a test to see if it does what I am hoping it will do, which is, beep and show the larger image for the main image when a given timage is clicked on in the custom imagelist area. 

     

    Thus, the TButton, btn's event will activate, beep and show a larger image for the main image.

     

    Again, I know nothing about events and how to create or modify them--unless someone shows me how.  Otherwise, this project will be on hold for a very long time since I have to figure this all out. But if/when I do, I will update this topic. 

     

     


  7. @Stano - re Point 3:  I have not figured out how to set an event to the TImages yet. I'm having trouble with it. I believe I have to assign an Event to the image each time I dynamically create one. 

     

    If I click on IM_2 for instance, nothing happens since there is no event because these images are created dynamically at runtime and I set the .Parent to the Scrollbox. I am still researching this portion.  But once I figure out how, then I can scroll up/down this custom imagelist and mouse-select on the image and that image will get shown on the main image on the left side. 

     

    re the Event, or fake wrapper event..

     

    What I have tried so far is this: 

     

    1. create a very small button, i.e., [:] -- I gave the button .name, btn, and the .caption as '[:]' to make it small and not as noticeable.  

        (If I can't figure out how to write an event to dynamically created TImages, then this button will be hidden later on when it's finally working.)

     

    2. in the button's properties, I added an .onClick event

     

    3. I write some code in the .onClick event and added code to sound a Beep (for testing purposes, to see which image in the custom imagelist I have clicked on). 

     

    Here is some code snippet thus far.  Everything works: (adding images and scrolling up/down in the image list) but the event is not, which is the Button's event at the moment. 

     

    var
      Form1: TForm1;
      cnt: integer = 0;
      StepCntr: integer = -105;
      posse: integer = 0;
      im: timage;
    
    implementation
    
    {$R *.dfm}
    
    // add a TImage to the imagelist inside the TScrollbox
    // evey time [add] button is clicked, a new TImage is dynamically created and added to the imagelist
    // 
    procedure TForm1.btnAddClick(Sender: TObject);
    begin
      // Note: im (the TImage) var is before the Implementation area.
    
      // dynamically create single TImage, and assign its .Parent to Scrollbox
      // and assign an .onclick event via a hidden [:] button.
      //
      // use that button's even code (below) to test which .Tag indicates which TImage
      // is clicked on.
      //
      im := timage.Create(self);
      im.Parent := sb1;
      im.OnClick := btn.OnClick;
    
      // intialize the TImage and calc its placement within the Scrollbox.
      //
      // keep track of the .Tag so we can use that as the indicator for which
      // TImage is clicked on in the imagelist area.
      //
      // The var cnt (or index, is a counter) to hold each TImage as ID (stored in the .Tag propery) so
      // that we can use that in the [:] button's logic to determin which TImage
      // was clicked and call the routine to show *that* image to the main image.
      //
      // the var StepCntr is to calc the image placement. 
      // 
      // And, for the portion of the project, I am writing via .Textout the image
      // name onto the image, so that I can keep track of what I am calling, etc.
      //
      inc(cnt);
      im.Tag:=cnt; // assign it an index no.
      inc(StepCntr, 105+3);
      im.Name   := 'IM_'+intTostr(cnt);  // assign im a name, i.e., IM_1, IM_2, ... IM_10
      im.top    := StepCntr+3;
      im.Left   := 3;
      im.Width  := 105;
      im.Height := 105;
      im.Canvas.TextOut(30, 40, 'IM_'+inttostr(cnt));
    
      // create border around image in custom imagelist.
      // 
      im.Canvas.Brush.Style := bsClear;
      im.Canvas.Pen.Color   := clBlue;
      im.Canvas.Rectangle(im.ClientRect);
    end;
    
    procedure TForm1.btnClick(Sender: TObject);
    begin
      // a fake but crude wrapper event to test weather clicking an individual
      // image in the imagelist is working.
      // 
      case im.tag of
        1: begin end;
        2: beep;      // we clicked on IM_2, so produce a audible tone
        3: begin end;
      end;
    end;

     


  8. Progress. . . 

     

    I have made some progress in this project.  I can now: 

     

    1. dynamically create a new Image inside a Scrollbox -- I had lots of trouble with this.  At first I was using TPaintbox but border/image would disappear when moving window around.  Now, I am using a TImage instead. It works. 

     

    2. and add a border around it - I had trouble figuring that out. also added border around main image, im1. 

     

    3. add text to it (showing the component name, i.e., (im1, im2, ... im10 and so on) -- had trouble with aligning text in each image. 

     

    4. I can also scroll up/down through the imagelist with the wheelmouse. 

     

    796506878_0201_screenshot-progress01-ImageListEx_d12_vcl_w10_v02.thumb.png.aff400486cf8e5c51b6f8127d1e54224.png

     

    Next steps:   

     

    1. is to get the screenshots into the main image and the image list inside the scrollbox.

     

    2.  possibly add a global hot-key -- Using the clipboard I can assign the image to the main image and then pass that on to the *new* image, as if I press the [add] button, but through code.  I am considering adding a global hot-key to this part of the process..., when I screenshot the window or whole desktop screen, add it to the main image and imagelist. 

     

    3. when I click on one of the images in the imagelist, to somehow have that image give the illusion of setfocus or something.  I haven't quiet figure on a solution yet. Maybe make the border around the image thicker.  But at the moment, I could not figure that out -- if anyone know how, please explain, thanks. 

     

    4. to add a save-all to save all the images into one file. I have not figure that out yet either.  One idea is to use a Zip archive.  But another could be to save all the images into one stream, and then Load the images from the stream back into the imagelist. 

     

    The one thing I regret in this topic is the subject title. I should have said, imagelist. Oh well. 

     


  9. In the Welcome screen, the Learn videos portion is available and comes up on my 6GB Win10 tablet, under Delphi 11 and 12.  I have both those IDE's working fine together. Infact, have them both running right now. But on my Win7 laptop with D11, the Learn videos portion does not come up. Actually, it has not come up in many weeks or longer. I prefer to watch videos on my 15" win7 laptop.  Yes!  I still use Windows 7 !!  I have a few Windows 10 devices. But Win7 is still my main machine.

     

    @Vandrovnik  so funny, LoL

     

     


  10. The images would be coming from the clipboard and would be in the same size dimensions.  For instance, when I am screenshotting Amazon or Ebay, I will take the whole screen, including the bottom statusbar/date/time area for proof of date and time. 

     

    The saving part would come after I've finished the screenshot session(s). I would have to figure out how to combine all the images into one, or save them in a zip and Load the zip back into the toolbar list. I haven't quite figured those parts as yet. There are plenty of zip resources to google up. 

     

    Not that anyone has brought this up but.. I've never worked with ImageList's. And last I remembered, the images have to be no larger than 32x32 dimensions.  And, I can't just paste from the clipboard into it.  I would have to reduce the size of the clipboard images down to 32x32, save them individually and then load them into the ImageList. So, the ImageList component in Delphi is out of the question. 

     

    I am looking in Delphi 12 to see if there are any new image type components. Then I google whatever info I can find on how to use them. 


  11. I use ms powerpoint to hold and store all my screenshots of various things throughout the day using my main laptop. I especially do this for items I purchase on Amazon and Ebay. 

     

    However, on my tablet I cannot do this since I don't have MS Office on it. 

     

    So now, I would like to create a rolling image bar that holds/shows all my screenshots made on the tablet and then save them all in one file, like a project.  I want to do something very similar to what powerpoint does, but nothing fancy.  Just a vertical toolbar that holds/shows all images I made.  

     

    Is there a component that can help me halfway through this project idea, or can I build something close to what I want to do with the tools/components already built into D11/D12 ?

     

    In my vision of such a tool, I have the following: 


    1. a panel/toolbar 
    2. an timage
    3. button to capture the screenshot(s)
    4. add/create a new timage in the toolbar every time I take a screenshot (get from cliboard, etc) 
    5. scroll up/down inside the toolbar of images that I took thus far 
    6. a main timage that shows the screenshot I take
    7. and if I click on any of the images in the toolbar, that image will show on the main timage

    8. save and load buttons

     

    All this in the above steps are basically what I do in ms powerpoint. 

     

    1856138356_ImageListEx_Screenshot2024-01-22184422.thumb.png.fc1319281684824c1b0dfd387e3eadd5.png

     


  12. specs:  Win7 and Win10

     

    In all my casual searches, I've never seen any kind of request for this. 

     

    I have an app that writes the date/time down.  Now, I would like to utilize it every time Windows startup or shutdown, but also when I put Windows in sleep mode and wake up from sleep, and also for Windows logon/logoff mode. 

     

    I will mostly be using it during Windows sleep modes, but I need it for shutdown as well. 

     

    Where do I put my app to make this happen? 


  13. Hi, I take many photos with my Android phone.  And now I need a way to Add some search text to the image so that I can find the photos.

     

    With a custom image viewer app I will create in conjunction with the metadata reader/writer, my search method would be to open the phone's Gallary (I don't know how to do this yet) and then enter a search word and only photos that match will show, like the way they do when you are in the Gallary app. 

     

    I searched around and see references for ccr-exif but it is for Delphi VCL, not FMX/Android.

     

    Is there a Delphi unit that provides this or someplace where I can download a working project to accomplish this ? TIA.

     


  14. Thanks to dummzeuch for the hint he made: '..read all entries in the section [mru].'

     

    I googled and found that there is a function, ReadSectionValue() that I can call and read the values into a list.  But continuing after that point I ran into some roadblocks. I need to check for duplicates and exclude them from being added back into the ini file. I eventually figured that portion out using a TStringList: { setting .sorted:=true } and { setting .duplicates:=dupIgnore }. I don't want the final list sorted, so I will have to maintain another list to keep the original unsorted list for the updated ini file. 

     

    Remy I will look into your suggestion(s) for the remaining parts. Thanks. 

     

    I will post the finished portions of how I managed it when I figure the rest out. 

     


  15. I'm building a front-end gui to a dos console app.  And I am utilizing the TIniFile to read/write to a settings.ini file.

     

    I need help with ideas of typical methods or algorithms for creating a rolling or recent folder location list, of say, the last 5 folder locations for a 'dos console app' that I call.  The location can be the hdd, flash drive, or another laptop/tablet. The folder locations will be obtained through the FileOpenDialog, so flash drives, mem sticks, etc., could change in a given scenario. 

     

    I currently have a small settings.ini file that holds just a few things at the moment, thus..

     

    [app settings:]
    app path=H:\D11\VCL\Misc\enc_gui\v01\Win32\Debug\
    last video src path:=J:\Tools\portable\
    last video dst path:=F:\dst\

    But I would like to add a recent list of last folder locations for this ini file for where the 'dos console app' will be pickd and stored so that I can extract that from the ini file and load it into a listbox and have a quick pick-list to choose from when I move from one device or folder location.  I sometimes jump from my laptop to my tablet, or throw in a flash/mem drive, and having this quick picklist would work well in my work-flow.  TIA.


  16. I mainly use Windows 7, and if I launch Delphi enough times, it will show up, like it is now, for Delphi 11 on my main win7 laptop that I use daily, 24-7. 

     

    My maximum app count is 15.  If I start using another app a given number of times, the entry for 'Delphi 11'  (it is the last one showing on the bottom of the start menu) will get bumped off and replaced with the latest commonly used app in its place. 

×