Topic: SelectedRow in a TableGrid

Hello Dmitry

I would like to retrieve two values into two columns of my TableGrid coming from a selected row.

I see that property SelectedRow is not available from MVD.

I've tried to "tinker" a script but without efficency, something like :

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
Var  SelectedRow : Integer;
     Google     : String;
     Web: TWebBrowser;
begin
      Web := TWebBrowser.Create(Map);
    Map.Show;
    TWinControl(Web).Parent := Map;
    Web.Width  := 800;
    Web.Height := 800;
    Google := 'https://www.google.com/maps/?q=';

    Form1.TableGrid1.ScrollToRow(Form1.TableGrid1.SelectedRow);
    Web.Navigate(Google + Form1.TableGrid1.Cells[5,SelectedRow]+ ',' + Form1.TableGrid1.Cells[6,SelectedRow]);
end;

But without success.

What would be good script with it ?

Thanks by advance

JB

Re: SelectedRow in a TableGrid

Hello,


try fix this line

  Web.Navigate(Google + Form1.TableGrid1.Cells[5,Form1.TableGrid1.SelectedRow]+ ',' + Form1.TableGrid1.Cells[6,Form1.TableGrid1.SelectedRow]);
Dmitry.

Re: SelectedRow in a TableGrid

Hello Dmitry

THanks, it works fine.
Another question :

I would like to use FileExists to test the presence of a picture in a folder.
As I use event SaveImagetoDataBaseFile,  I store always same picture in a folder. (by LinkToFile)
The goal of FileExists is to verify such a picture stands already in the folder.
So if yes, I delete it and save it again (this to avoid incrementation : picture, picture(1), picture(2) with Rewrite action.
It seems that MVD don't knows FileExists (Undeclared Identifier)
It would amaze me that SysUtils unit is not implemented in MVD.

Thanks for your answer

JB

Re: SelectedRow in a TableGrid

Hello,


Function FileExists is present.
Check it out:

if FileExists('d:\1.txt') then ShowMessage('FileExists') else ShowMessage('File not exists');
Dmitry.

Re: SelectedRow in a TableGrid

Hello Dmitry

Thanks for your answer.
In fact, it was my own mistake.
Error message raised because I have wrote FileExist without the ending (s)
It also surprised me that the unit is not implemented
How could we use function copy during a backup?
All my excuses
Thanks again

JB

Re: SelectedRow in a TableGrid

Here you can find an example, how to make backup
http://myvisualdatabase.com/forum/viewtopic.php?id=1438

Dmitry.

Re: SelectedRow in a TableGrid

hi, this code not working.
get an error message " undeclared identifier Map"

procedure Form1_Button2_OnClick (Sender: string; var Cancel: boolean);

    Var  SelectedRow : Integer;
     Google     : String;
     Web: TWebBrowser;
begin
      Web := TWebBrowser.Create(Map);
    Map.Show;
    TWinControl(Web).Parent := Map;
    Web.Width  := 800;
    Web.Height := 800;
    Google := 'https://www.google.com/maps/?q=';
    Form1.TableGrid1.ScrollToRow(Form1.TableGrid1.SelectedRow);
     Web.Navigate(Google + Form1.TableGrid1.Cells[5,Form1.TableGrid1.SelectedRow]+ ',' + Form1.TableGrid1.Cells[6,Form1.TableGrid1.SelectedRow]);
end;

Re: SelectedRow in a TableGrid

majuten
Hello.


Map is a Form. Just create a new form with name "Map"

Dmitry.