Page 1 of 1
String gadget problem
Posted: Mon Feb 21, 2005 11:22 am
by chippy73
I am using the following code:-
Code: Select all
Case #Gadget_Form1_Editortx
If GetAsyncKeyState_(#VK_CONTROL)
If GetKeyState_(82)
txstring$ = GetGadgetText(#Gadget_Form1_Editortx)
SetGadgetText(#Gadget_Form1_Editortx,txstring$ + Chr(135))
EndIf
EndIf
I notice that control R sends the cursor to the right hand side of my multiline string gadget, which is what I am detecting in the code above. Is there a way to inhibit this movement?
Also I am trying to find the ascii code for a symbol which is a vertical bar with an up arrow on the top and a down arrow on the bottom. I think it is a DOS character, but I cant find anything like it anywhere.
Alan
Posted: Mon Feb 21, 2005 3:49 pm
by ebs
Also I am trying to find the ascii code for a symbol which is a vertical bar with an up arrow on the top and a down arrow on the bottom. I think it is a DOS character, but I cant find anything like it anywhere.
Try Chr($12) - I think that's what you're looking for.
I'm not sure if it's in all fonts, but I found it in Lucida Console, Courier New, MS Sans Serif and others.
Regards,
Eric
Posted: Tue Feb 22, 2005 10:20 am
by chippy73
Eric,
Thanks for your comments. CHR(12) didn't give me the correct graphic, but CHR(18) did !! Strange that they are different. Oh well.
Doesn't help me as I need to send CTRL R to the dos screen and from PB it just shifts the cursor to the right in a string gadget.
Back to the drawing board.
Alan
Posted: Tue Feb 22, 2005 1:47 pm
by ebs
chippy73 wrote:Eric,
Thanks for your comments. CHR(12) didn't give me the correct graphic, but CHR(18) did !! Strange that they are different. Oh well.
Alan
That's because I suggested that you use Chr($12), not Chr(12).
$12 (hex) = 18 (decimal).
Sorry it didn't help.
Eric
Posted: Tue Feb 22, 2005 2:18 pm
by Sparkie
Are you using a StringGdaget or EditorGadget? In an EditorGadget, Ctrl+R = Right alignment.
Posted: Tue Feb 22, 2005 7:29 pm
by chippy73
Eric,
Yes of course, silly me. Having a bad hair day !!
Sparkie,
I'm using a string gadget.
Alan
Posted: Tue Feb 22, 2005 9:13 pm
by Sparkie
Will this work for you?
Code: Select all
#Window_Main = 0
#Gadget_Form1_Editortx = 0
If OpenWindow(#Window_Main, 0 ,0, 300, 200, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "StringGadget") And CreateGadgetList(WindowID(0))
StringGadget(#Gadget_Form1_Editortx, 10, 10, 280, 180, "Multiline StringGadget" + Chr(13) + Chr(10) + "second line...", #PB_String_MultiLine)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Control | #PB_Shortcut_R, 1)
Repeat
event = WaitWindowEvent()
If event = #PB_EventMenu And EventMenuID() = 1
txstring$ = GetGadgetText(#Gadget_Form1_Editortx)
SetGadgetText(#Gadget_Form1_Editortx, txstring$ + Chr(18))
EndIf
Until event = #PB_Event_CloseWindow
EndIf
End
Posted: Wed Feb 23, 2005 5:26 pm
by chippy73
Sparkie,
Yes that will be very useful, many thanks.
Not used AddKeyboardShortcut before. Now I see how to use it.
Thanks again for your help.
Alan
Posted: Thu Feb 24, 2005 2:39 pm
by Sparkie
Your welcome chippy73
