how to execute inkey() procedure inside get object
by Krzysztof Ciura » Tue, 29 Jun 2004 05:36:22 GMT
I've tried to write a simple procedure which allow
during executing get procedure applying a new value to get viriable
depending
on presing key.
I stacked :((
How to reslove this problem please help me...
for example:
I want get "NewVar" viriable (let it be string for ex.)
I start writing string from keyboard and it (string)
is putting into buffer of my viriable but this viriable must be
in range which is stored (for example) in an array and by pressing
a key (F_2) I want have acces to this array and be able to chose
new value for my viriable from this array. Is this procedure possible?
I've tryed something like this but it didn't work:
#include inkey.ch
...
NewVar := GetNew()
NewVar :row := 10
NewVar :col := 10
NewVar :name := "cVar1"
NewVar :block := { |cValue| IF (lastkey()==K_F2,;
cVar1:=func(), cvar1) }
...
function func()
return nValue
Re: how to execute inkey() procedure inside get object
by Douglas Woodrow » Tue, 29 Jun 2004 08:15:48 GMT
On Sun, 27 Jun 2004 22:36:22 Krzysztof Ciura < XXXX@XXXXX.COM > wrote
Hello Krzysztof,
1) Have you considered using the SetKey() function?
2) For the actual example you gave, wouldn't it be better to do
everything in a validation function for that get object?
(i.e. automatically present a picklist of the possible array values if
the user's input is not one of them.)
Regards.
--
Douglas Woodrow
Re: how to execute inkey() procedure inside get object
by Krzych » Tue, 29 Jun 2004 15:52:13 GMT
Uzytkownik "Douglas Woodrow" < XXXX@XXXXX.COM > napisal w wiadomosci
Yes but it have to send parameter depending on active get into function
launched by pressing key()
Yes it's logical (user can't put different value from that in the array) but
I thougt of normal get (could be validated) and during editing pressing key
(F2) would execute function (i.e. display array)
Great thanks Douglas
Regards
Krzych
Re: how to execute inkey() procedure inside get object
by Stephen Quinn » Tue, 29 Jun 2004 17:12:53 GMT
Krzych
It can you need to issue another READ though.
Something along the lines of (check the syntax<g>)
Eg
@ x, y GET xyz ;
WHEN {|| SetKey( K_F2, SomeFunc() ), TRUE }
VALID {|| SetKey( K_F2, NIL ), TRUE }
Function SomeFunc()
LOCAL aGetList := GetList()
LOCAL oGet := GetActive()
LOCAL aList := { // Values to choose from}
LOCAL x, y
x := oGet:Row
y := oGet:Col + 25
@ x, y GET cValue AS COMBOBOX aList // Achoice/Picklist?
READ
oGet:SetValue( cValue )
RETURN TRUE
Re: how to execute inkey() procedure inside get object
by Douglas Woodrow » Tue, 29 Jun 2004 18:56:44 GMT
On Mon, 28 Jun 2004 08:52:13 Krzych < XXXX@XXXXX.COM > wrote
OK, but I'm not sure what your difficulty with SetKey() is. Try
compiling this test program to see what I mean.
// --------------------------------------------------
#include "inkey.ch"
Procedure Main()
Local GetList := {}
Local cVar1 := "One"
Local cVar2 := "Two"
CLS
@10, 10 SAY "Input 1:" GET cVar1
@12, 10 SAY "Input 2:" GET cVar2
SetKey( K_F2, {|| Special() } )
READ
SetKey( K_F2, NIL )
Return
Procedure Special()
Local oGet := GetActive()
If oGet <> NIL
If oGet:Name == "cVar1"
// (display your array here)
Alert("Input 1")
oGet:VarPut("New")
ElseIf oGet:Name == "cVar2"
Alert("Input 2")
EndIf
EndIf
Return
// --------------------------------------------------
NB You may want to guard against Special() being called recursively.
It can also sometimes be useful to pass the GetList to the Special()
procedure if you need to access any get object other than the active
one.
HTH,
--
Douglas Woodrow
Re: how to execute inkey() procedure inside get object
by Krzych » Tue, 29 Jun 2004 19:31:54 GMT
:))
It is so simple :)
I've worked in clipper 5 y ago and forgot almost everything
thanx
Chris
Uzytkownik "Douglas Woodrow" < XXXX@XXXXX.COM > napisal w wiadomosci
wiadomosci
but
key
Re: how to execute inkey() procedure inside get object
by Krzysztof Korzeniowski » Wed, 30 Jun 2004 07:06:21 GMT
BTW... how can I display message depending on which get object is currently
active ?
Now I use simple @ get commands and Read.
Chris
Uzytkownik "Douglas Woodrow" < XXXX@XXXXX.COM > napisal w wiadomosci
wiadomosci
but
key
Re: how to execute inkey() procedure inside get object
by Douglas Woodrow » Wed, 30 Jun 2004 09:05:36 GMT
On Tue, 29 Jun 2004 00:06:21 Krzysztof Korzeniowski < XXXX@XXXXX.COM >
wrote
Sorry,
I don't understand the question - can you explain it in more detail?
--
Douglas Woodrow
Re: how to execute inkey() procedure inside get object
by Pete » Wed, 30 Jun 2004 15:11:57 GMT
?"Krzysztof Korzeniowski" < XXXX@XXXXX.COM > ?
currently
You can do it either the easy (and ugly) or the difficult (but elegant)
way...
easy things first..
/*code*/
@ nRow, nCol get MyVar when ShowMessage( "A seemly message" )
static func ShowMessage( cMess )
@ maxrow(), 0 say padc( cMess )
return .t.
/*endcode*/
The 'difficult' way is to modify the getsys system (not recommented if you
have no done this before).
I think i 've got somewhere in my disk such a modified getsys.prg (which i
could send but) i think also you could find something similar in the Oasis.
rgrds,
---
Pete
Re: how to execute inkey() procedure inside get object
by Krzych » Wed, 30 Jun 2004 17:52:44 GMT
Situation is somilar to those in previous example. I have cople get-s:
@ say... get
@ say .. get
...
READ
,and want display a mesage (text) when cursor is in get field and field is
active durning executing READ but message should be visible only when
get is active and different for each get object.
I don't know wheter it's possible in this simple way or I have use more
advanced commands (get system??)
Regards
Chris
Uzytkownik "Douglas Woodrow" < XXXX@XXXXX.COM > napisal w wiadomosci
currently
Re: how to execute inkey() procedure inside get object
by Krzych » Wed, 30 Jun 2004 17:56:06 GMT
Oasis??
What You exactly mean ??
rgrds
Chris
Utkownik "Pete" < XXXX@XXXXX.COM > napisa?w wiadomoi
i
Oasis.
Re: how to execute inkey() procedure inside get object
by Pete » Wed, 30 Jun 2004 18:24:16 GMT
?"Krzych" < XXXX@XXXXX.COM > ?
Yes! Oasis. ;->
Sorry, I arbitrarily made the assumption that being here in CLC, you 'd also
have been there -in Oasis.
Oasis is Cliper-heads "promised land". You can get there this way:
http://www.**--****.com/
rgrds,
---
Pete
Re: how to execute inkey() procedure inside get object
by Stephen Quinn » Thu, 01 Jul 2004 10:28:22 GMT
Krzych
When you get to the OASIS make sure you d/l the GrumpFish and SuperLib
libraries, you should find suitable GET commands to satisfy the MESSAGE display
you want.
Similar Threads:
1.Re : Getting path of a shared object from inside it
On 21/06/2005 14:40, sug wrote:
> Hi,
>
> I am running a C program on Unix which loads a shared object of mine.
>
> I need to get the path of my .so from inside it. I want to do this
> because from my .so I want to open a text file which is in same
> directory as my .so.
>
> getcwd() obviously doesn't serve my purpose because my .so is not in
> "cwd" but I am pointing my executable to it using the
> LIBPATH/LD_LIBRARY_PATH.
>
> Can somebody provide any pointers? Thanks in advance
>
>
> Sug
>
2.Getting path of a shared object from inside it
Hi,
I am running a C program on Unix which loads a shared object of mine.
I need to get the path of my .so from inside it. I want to do this
because from my .so I want to open a text file which is in same
directory as my .so.
getcwd() obviously doesn't serve my purpose because my .so is not in
"cwd" but I am pointing my executable to it using the
LIBPATH/LD_LIBRARY_PATH.
Can somebody provide any pointers? Thanks in advance
Sug
3.Default compiler action (was: Atomic statements execute more than once inside a thread)
4.Atomic statements execute more than once inside a thread
Hi.
I'm write a "passthru" application which is reading from one socket
and writing to a pool of outcoming sockets. From time to time I have
date duplicated in the socket and when I debug the function below,
using step by step, I find that printf("LINE 1\n"); executes more than
once every time I hit F10 (Visual C++). I never saw something like
that.
Very weird!!!!!!!!!!!
unsigned __stdcall inWriteIncomingSocket(void* data) {
cMySocket *IncomingSocket;
cMySocket *OneSocket;
unsigned char chTCPBuffer[1024];
unsigned int uiTCPBufferSize;
int inResult;
int i, j;
inWriteToLog("inWriteIncomingSocket", FOREGROUND_RED +
FOREGROUND_BLUE);
IncomingSocket = (cMySocket *)data;
while(1) {
Sleep(SLEEP_TIME2);
inResult = IncomingSocket->hGetSocketHandler();
if(inResult<=0) continue;
//printf("ESCRIBIENDO A INCOMING SOCKET\n");
for(i=0; i<inSocketsPoolSize; i++) {
Sleep(SLEEP_TIME1);
OneSocket = SocketsPool[i];
if(!OneSocket) continue;
if(OneSocket-
>uiCurrentState==SOCKET_STATE_DATA_FOR_CLIENT_AVAILABLE) {
if(OneSocket->bGetTCPBuffer(chTCPBuffer, &uiTCPBufferSize)) {
//printf("PTVC->NAC (SIZE=
%d)--------------------------------------------------\n",
uiTCPBufferSize);
printf("LINE 1\n");
printf("LINE 2\n");
for(j=0; j<uiTCPBufferSize; j++) {
printf("%02X ", chTCPBuffer[j]);
}
printf("\n\n");
if(!IncomingSocket->bSend(chTCPBuffer, uiTCPBufferSize)) {
OneSocket->vdForceDisconnect();
}
}
OneSocket->uiCurrentState = SOCKET_STATE_SENDING_RECEIVING;
//IncomingSocket->bSend();
}
}
}
}
5.Executing code inside "#if 0"
There are some blocks of C/C++ code put under
#if 0
#end if
Is there anyway to make the code inside these blocks to get executed
(may be by using some command line options)?
I am using SUN compiler.
6. Executing procedure in thread
7. Execute Stored procedure using AdoCommand
8. Question about Dataminer syntax to execute Stored Procedure