String gadget problem

Windows specific forum
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

String gadget problem

Post 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
ebs
Enthusiast
Enthusiast
Posts: 563
Joined: Fri Apr 25, 2003 11:08 pm

Post 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
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

Post 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
ebs
Enthusiast
Enthusiast
Posts: 563
Joined: Fri Apr 25, 2003 11:08 pm

Post 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
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Are you using a StringGdaget or EditorGadget? In an EditorGadget, Ctrl+R = Right alignment.
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

Post by chippy73 »

Eric,
Yes of course, silly me. Having a bad hair day !!

Sparkie,
I'm using a string gadget.


Alan
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post 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
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

Post 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
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Your welcome chippy73 :)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Post Reply