Page 1 of 1

Using JQWeather with lon/lat or address

PostPosted: 09 Aug 2018 13:09
by PeterSondergaard
Hi

I have been trying to get the JQWeather component to work in my Intraweb project in C++

I found an old post that describes how it is done in pascal but it does not seems to work in c++

I can get it working with the Woeid parameter like this:

dynamic_cast<TIWCGJQSimpleWeatherOptions*>(IWCGJQWeather1->JQWeatherOptions)->Woeid = 29306354;

or more direct:

IWCGJQWeather1->JQSimpleWeatherOptions()->Woeid = 29306354;

But when I try to use the Location or LocationFn option does it fail:

IWCGJQWeather1->JQSimpleWeatherOptions()->LocationFn->Script = "function () { return \"46.9062324, -102.78000830000002\"; }";

Can you tell me what I do wrong?

I am using RAD studio 10 Seattle and Intraweb 14.0.52

Regards
Peter Søndergaard

Re: Using JQWeather with lon/lat or address

PostPosted: 10 Aug 2018 18:04
by Alexander Bulei
Hi PeterSondergaard,

Don't use the LocationFn property, use the Location instead:

delphi code
IWCGJQWeather1.JQWeatherOptions.Location:= '[46.9062324, 102.78000830000002]';


Best Regards.

Re: Using JQWeather with lon/lat or address

PostPosted: 12 Aug 2018 21:37
by PeterSondergaard
Hi Alexander

Thanks for the quick reply.
Sadly does it not work. I tested it in both C++ and in Delphi.

One note. I can not find the Location parameter in the JQWeatherOptions but I can find it in JQSimpleWeatherOptions.

I tried to make a simple Delphi project with 3 components (TIWCGJQWeather, TIWButton and a TIWButton)
where I added the following code to the button event:

procedure TIWForm1.IWButton1Click(Sender: TObject);
begin
IWCGJQWeather1.JQSimpleWeatherOptions.GetOnInit := false;
IWCGJQWeather1.JQSimpleWeatherOptions.TempUnit := jqwduCelsius;
IWCGJQWeather1.JQSimpleWeatherOptions.Location := IWEdit1.Text;

IWCGJQWeather1.JQSimpleWeatherOptions.DoGetWeatherInfo();
end;


The IWEdit field allowed me to test different combinations of the input.
like:
[46.9062324, 102.78000830000002]
46.9062324, 102.78000830000002
(46.9062324, 102.78000830000002)
"46.9062324, 102.78000830000002"
aso.
But all fail.
Any good idea why it continues to fail?

Regards
Peter

Re: Using JQWeather with lon/lat or address

PostPosted: 13 Aug 2018 09:04
by Alexander Bulei
Hi PeterSondergaard,

procedure TIWForm1.IWButton1Click(Sender: TObject);
begin
IWCGJQWeather1.JQSimpleWeatherOptions.GetOnInit := false;
IWCGJQWeather1.JQSimpleWeatherOptions.TempUnit := jqwduCelsius;
IWCGJQWeather1.JQSimpleWeatherOptions.Location := IWEdit1.Text;

IWCGJQWeather1.JQSimpleWeatherOptions.DoGetWeatherInfo();
end;


Initialize the plugin on form/frame create.

Best Regards.