google search box

Anything related to Hollywood Designer goes in here
Post Reply
leavereality
Posts: 18
Joined: Sat Sep 28, 2019 1:39 pm

google search box

Post by leavereality »

I knew I shouldn't of tried adding just one more feature to my app, but anyway, trying to make a text box the user can enter data into and then on click it would perform a Google Search based on whats was entered, via either OpenURL or Rabbit Hole.

So got a Txt box named Dave for the user to enter data, (identify is the same)

On the Button i Got the following code

Code: Select all

Bob = "C:winlaunch >NIL: https://google.com/search?q="
Vince = Bob, Dave
Execute(Vince)
So this works, it open up Chrome to Google, but what ever is entered into Dave is not captured.
what should happen is any text in Dave is added to the end of Bob.

So if the user entered "ships" into Dave, then Im hoping Vince becomes

Code: Select all

C:winlaunch >NIL: https://google.com/search?q=https://google.com/search?q=ships
which will trigger windows to open https://google.com/search?q=ships

any idea, promise this is the last thing i bother you guys with, Im not much of a programmer trying to get better. cheers

plouf
Posts: 190
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: google search box

Post by plouf »

ok first if
Vince = Bob, Dave
is suppuposed to add two strings the correct on is
Vince = Bob..Dave

secondly i dont know winlauch (this is an non standar windwos application), but under windows you can direct execute url's

so the following on is working

Code: Select all

Dave="test"
Bob = "https://google.com/search?q="
Vince = Bob..Dave
Execute(Vince)
Christos

leavereality
Posts: 18
Joined: Sat Sep 28, 2019 1:39 pm

Re: google search box

Post by leavereality »

Cheers for the reply but it still not pulling in the text from Dave, of course your code will do "https://google.com/search?q=test"
but how do i pull text from a text Object in hollywood designer?

On Button Click I have this now..

Code: Select all

Bob = "C:winlaunch >NIL: https://google.com/search?q="
Vince = Bob..Dave
Execute(Vince)
With Dave being the text object that the user can edit.

plouf
Posts: 190
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: google search box

Post by plouf »

my code works because i have assign Dave with proper text string.

IF it not working with you then the problem is to assign Dave proper text
you should provide more part of your program and better identify the exact problem

i..e is this a Rapagui app ?
text object has proper id ?

minimum "problematic" source code with rapagui XML should be provided to identify your problem

edit..
does the line
DebugPrint(dave)
before these 3 lines, prints in debugwindow "ships" ?
Christos

plouf
Posts: 190
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: google search box

Post by plouf »

on a second thought, about what you are asking for ..

Code: Select all

@REQUIRE "RapaGUI"

moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application>
   <window title="Test program">
      <vgroup>
	<textentry id="searchquery" />
         <button id="GoogleIt">GoogleIt</button>
      </vgroup>
   </window>
</application>
]])

Function p_myfunc(msg)
	If msg.attribute = "Pressed"  
		Dave = moai.Get("searchquery","Text")
		Bob = "https://google.com/search?q="
		Vince = Bob..Dave
		Execute(Vince)
	EndIf
EndFunction

InstallEventHandler({RapaGUI = p_myfunc})


Repeat
   WaitEvent
Forever
Christos

leavereality
Posts: 18
Joined: Sat Sep 28, 2019 1:39 pm

Re: google search box

Post by leavereality »

Cheers for your help, I might use that code as away around the problem, was just hoping to make it part of my App, which I built in Designer (that why im posting in the Designer section of the Forum) uploaded a very quick example of the project here
https://amigang.com/software/google.lha

plouf
Posts: 190
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: google search box

Post by plouf »

ok sorry, i did not realize its in Designer.... thats why it does not fit the question :)

anyway here is (note htat its the first tiem i do it too :))

Code: Select all

Bob = "C:winlaunch >NIL: https://google.com/search?q="
Vince = Bob..GetAttribute(#LAYER,"Dave",#ATTRTEXT)
Execute(Vince)
Christos

leavereality
Posts: 18
Joined: Sat Sep 28, 2019 1:39 pm

Re: google search box

Post by leavereality »

Image
;)

Cheers for you help, sorryif I did'nt make it clear to star with, but still your other suggestion still gives me a understanding how RapaGUI app would be built, so cheers!!! 8-)

Post Reply