CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Using JQWeather with lon/lat or address

by PeterSondergaard » 09 Aug 2018 13:09

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
PeterSondergaard
 
Posts: 12
Joined: 02 Jun 2014 13:56

by Alexander Bulei » 10 Aug 2018 18:04

Hi PeterSondergaard,

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

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


Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by PeterSondergaard » 12 Aug 2018 21:37

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
PeterSondergaard
 
Posts: 12
Joined: 02 Jun 2014 13:56

by Alexander Bulei » 13 Aug 2018 09:04

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.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal


Return to JQWeather

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.