Page 1 of 1
google search box
Posted: Thu Mar 25, 2021 4:50 pm
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
Re: google search box
Posted: Thu Mar 25, 2021 5:02 pm
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)
Re: google search box
Posted: Fri Mar 26, 2021 6:57 pm
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.
Re: google search box
Posted: Fri Mar 26, 2021 7:08 pm
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" ?
Re: google search box
Posted: Sat Mar 27, 2021 11:30 am
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
Re: google search box
Posted: Sat Mar 27, 2021 1:16 pm
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
Re: google search box
Posted: Sat Mar 27, 2021 2:25 pm
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)
Re: google search box
Posted: Sat Mar 27, 2021 3:55 pm
by leavereality