PDA

View Full Version : Dialog.Input Help #2


GoOgLe
03-23-2007, 02:35 PM
selString = Input.GetSelection("Input1");
if selString ~= nil then
link = Dialog.Input("WEB", "LINK:", "", MB_ICONQUESTION);
text = Dialog.Input("LINK", "TEXT:", "", MB_ICONQUESTION);
if (link ~= "CANCEL") then
tblSelected = Input.GetSelection("Input1")
if tblSelected then
nPos = tblSelected.Start - 1
sLinkText = String.Mid(Input.GetText("Input1"), tblSelected.Start, tblSelected.End - tblSelected.Start + 1)
else
nPos = GetCaretPos("Input1")
sLinkText = text
end
if nPos == 0 then
Input.SetText("Input1", "{URL=\""..link.."\"]"..sLinkText.."{/URL]"..Input.GetText("Input1"))
elseif nPos == String.Length(Input.GetText("Input1")) then
Input.SetText("Input1",Input.GetText("Input1").. "{URL=\""..sLinkText.."\"]"..link.."{/URL]")
else
sBefore = String.Left(Input.GetText("Input1"), nPos)
if tblSelected then
sAfter = String.Mid(Input.GetText("Input1"), tblSelected.End + 1, -1)
else
sAfter = String.Mid(Input.GetText("Input1"), nPos + 1, -1)
end
Input.SetText("Input1", sBefore.."{URL=\""..link.."\"]"..sLinkText.."{/URL]"..sAfter)
end
end
else
Dialog.Input("LINK", "TEXT:", selString, MB_ICONQUESTION);

what's wrong with the code ???

Worm
03-23-2007, 02:54 PM
Did you replace the { with [ and the } with ]

When I posted I had to change to the other bracket so the forum wouldn't format the code.

GoOgLe
03-23-2007, 02:58 PM
selString = Input.GetSelection("Input1");
if selString then
text = Dialog.Input("LINK", "TEXT:", selString, MB_ICONQUESTION);
else
text = Dialog.Input("LINK", "TEXT:", "", MB_ICONQUESTION);
end

link = Dialog.Input("WEB", "LINK:", "", MB_ICONQUESTION);
if (link ~= "CANCEL") then

tblSelected = Input.GetSelection("Input1")
if tblSelected then
nPos = tblSelected.Start - 1
sLinkText = String.Mid(Input.GetText("Input1"), tblSelected.Start, tblSelected.End - tblSelected.Start + 1)
else
nPos = GetCaretPos("Input1")
sLinkText = text
end
if nPos == 0 then
Input.SetText("Input1", "{URL=\""..link.."\"]"..sLinkText.."{/URL]"..Input.GetText("Input1"))
elseif nPos == String.Length(Input.GetText("Input1")) then
Input.SetText("Input1",Input.GetText("Input1").. "{URL=\""..sLinkText.."\"]"..link.."{/URL]")
else
sBefore = String.Left(Input.GetText("Input1"), nPos)
if tblSelected then
sAfter = String.Mid(Input.GetText("Input1"), tblSelected.End + 1, -1)
else
sAfter = String.Mid(Input.GetText("Input1"), nPos + 1, -1)
end
Input.SetText("Input1", sBefore.."{URL=\""..link.."\"]"..sLinkText.."{/URL]"..sAfter)
end
end

i tried that but it didnt work too

GoOgLe
03-23-2007, 03:15 PM
this is the error i get

Worm
03-23-2007, 03:20 PM
selString = Input.GetSelection("Input1");
if selString then
text = Dialog.Input("LINK", "TEXT:", String.Mid(Input.GetText("Input1"), selString.Start, selString.End - selString.Start), MB_ICONQUESTION);
else
text = Dialog.Input("LINK", "TEXT:", "", MB_ICONQUESTION);
end

GoOgLe
03-23-2007, 03:23 PM
now i got this error when i select text

Worm
03-23-2007, 03:25 PM
I mistyped... look at the code above, I edited to correct the error.

GoOgLe
03-23-2007, 03:26 PM
thanks alot worm that worked