Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #2471 > unrolled thread
| Started by | D.J.W. van Kooten <public@ic2remove.this.com> |
|---|---|
| First post | 2011-11-21 23:10 +0100 |
| Last post | 2011-11-26 13:40 +0100 |
| Articles | 10 — 6 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Convert "string" describing define to define D.J.W. van Kooten <public@ic2remove.this.com> - 2011-11-21 23:10 +0100
Re: Convert "string" describing define to define "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> - 2011-11-22 09:51 +1100
Re: Convert "string" describing define to define D.J.W. van Kooten <public@ic2remove.this.com> - 2011-11-22 13:27 +0100
Re: Convert "string" describing define to define E®!k \\/!$$E® <nospam@nospam.url> - 2011-11-22 14:05 +0100
Re: Convert "string" describing define to define D.J.W. van Kooten <public@ic2remove.this.com> - 2011-11-22 18:09 +0100
Re: Convert "string" describing define to define Camille Kater <katercamXXX@pt.lu> - 2011-11-22 16:48 +0100
Re: Convert "string" describing define to define D.J.W. van Kooten <public@ic2remove.this.com> - 2011-11-22 19:17 +0100
Re: Convert "string" describing define to define "Marc Verkade [Marti]" <marcatm@rti.nl> - 2011-11-26 11:06 +0100
Re: Convert "string" describing define to define "richard.townsendrose" <richard.townsendrose@gmail.com> - 2011-11-26 03:12 -0800
Re: Convert "string" describing define to define E®!k \\/!$$E® <nospam@nospam.url> - 2011-11-26 13:40 +0100
| From | D.J.W. van Kooten <public@ic2remove.this.com> |
|---|---|
| Date | 2011-11-21 23:10 +0100 |
| Subject | Convert "string" describing define to define |
| Message-ID | <ltilc7ljjs1a0tqki3b7a4ib02sg6h5ivm@4ax.com> |
I must be missing something obvious.... I have lines like this: DEFINE IDM_iConnectFinEmptyShellMenu_MN_BESTAND_Temporary_operations_Import_specifications_ID := 23718 And I need to retrieve the value (now 23718 but changing as soon as I change someting in the menu). Something like : nValue:=string2Define(IDM_iConnectFinEmptyShellMenu_MN_BESTAND_Temporary_operations_Import_specifications_ID) (so I can do something like SELF:DisableItem(nValue) How can I achieve this? Dick
[toc] | [next] | [standalone]
| From | "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> |
|---|---|
| Date | 2011-11-22 09:51 +1100 |
| Message-ID | <MBAyq.6277$7r4.715@viwinnwfe02.internal.bigpond.com> |
| In reply to | #2471 |
Dick
What's wrong with
nValue := Menu_ID
and if you want the string of it
xValue := ntrim( nValue )
Much better to stick with the DEFINEd ID, more wordy but there is no need to
do any conversions/lookups
Eg
(so I can do something like SELF:DisableItem( Menu_ID )
> And I need to retrieve the value (now 23718 but changing as soon as I
> change someting in the menu).
Well it would as they are re-created anew when you make changes to the menu.
CYA
Steve
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <public@ic2remove.this.com> |
|---|---|
| Date | 2011-11-22 13:27 +0100 |
| Message-ID | <p45nc79824o60b5isc1f69vmtvj3to6l7s@4ax.com> |
| In reply to | #2475 |
On Tue, 22 Nov 2011 09:51:45 +1100, "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> wrote: Hello Steve, > >What's wrong with > nValue := Menu_ID Well, it doesn't work. I have a file with the menu-ID's (where I add a ; or not to separate menu ID's to disable and enable). So that leaves me with a string. VAL(IDM_iConnectFinEmptyShellMenu_MN_BESTAND_Temporary_operations_Import_specifications_ID) = 0 of course, not 23718. That's my problem.... Dick
[toc] | [prev] | [next] | [standalone]
| From | E®!k \\/!$$E® <nospam@nospam.url> |
|---|---|
| Date | 2011-11-22 14:05 +0100 |
| Message-ID | <9j1l1dFqjgU1@mid.individual.net> |
| In reply to | #2471 |
Dick, The defines are 'searched and replaced' by the preprocessor, even before compilation. So there is define no way to get the name of the constant at runtime. Look at how this is solved in the VO Definer. There are stringtables generated as well as arrays with the names (as strings ) and the values of the constants. Erik "D.J.W. van Kooten" schreef in bericht news:ltilc7ljjs1a0tqki3b7a4ib02sg6h5ivm@4ax.com... I must be missing something obvious.... I have lines like this: DEFINE IDM_iConnectFinEmptyShellMenu_MN_BESTAND_Temporary_operations_Import_specifications_ID := 23718 And I need to retrieve the value (now 23718 but changing as soon as I change someting in the menu). Something like : nValue:=string2Define(IDM_iConnectFinEmptyShellMenu_MN_BESTAND_Temporary_operations_Import_specifications_ID) (so I can do something like SELF:DisableItem(nValue) How can I achieve this? Dick
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <public@ic2remove.this.com> |
|---|---|
| Date | 2011-11-22 18:09 +0100 |
| Message-ID | <2olnc7lfm7tkvuntn8ilmg60ggnvenimce@4ax.com> |
| In reply to | #2482 |
On Tue, 22 Nov 2011 14:05:48 +0100, E®!k \\/!$$E® <nospam@nospam.url> wrote: Hello Erik, > >The defines are 'searched and replaced' by the preprocessor, even before >compilation. So there is define no way to get the name of the constant at >runtime. >Look at how this is solved in the VO Definer. There are stringtables >generated as well as arrays with the names (as strings ) and the values of >the constants. > I did indeed look in VODefiner and hoped that there was a better way <g>. I think you're right. I've now hard coded it as follows: CASE cDef="IDM_iConnectFinEmptyShellMenu_MN_BESTAND_Temporary_operations_ID" nDef:=IDM_iConnectFinEmptyShellMenu_MN_BESTAND_Temporary_operations_ID CASE cDef="IDM_iConnectFinEmptyShellMenu_MN_BESTAND_Temporary_operations_Import_specifications_ID" nDef:=IDM_iConnectFinEmptyShellMenu_MN_BESTAND_Temporary_operations_Import_specifications_ID etc, If you just look at the code you simply would expect there to be a simpler way.... Dick
[toc] | [prev] | [next] | [standalone]
| From | Camille Kater <katercamXXX@pt.lu> |
|---|---|
| Date | 2011-11-22 16:48 +0100 |
| Message-ID | <1321977371_2957@vo.lu> |
| In reply to | #2471 |
Hi Dick,
Maybe this function from Ivo Wessel can help:
Function MenuGetID (oMenu, symEventName) As DWord
// Ermittelt aus dem symbolischen EventName einer Option die numerische ID
Local nPos, nID As DWord
nPos := AScan (oMenu:Items, { | a | a [2]:nameSym == symEventName })
IF nPos > 0
nID := oMenu:Items [nPos,1]
ENDIF
Return nID
Camille
On 21/11/2011 23:10, D.J.W. van Kooten wrote:
> I must be missing something obvious....
>
> I have lines like this:
>
> DEFINE
> IDM_iConnectFinEmptyShellMenu_MN_BESTAND_Temporary_operations_Import_specifications_ID
> := 23718
>
> And I need to retrieve the value (now 23718 but changing as soon as I
> change someting in the menu).
>
> Something like :
>
> nValue:=string2Define(IDM_iConnectFinEmptyShellMenu_MN_BESTAND_Temporary_operations_Import_specifications_ID)
>
> (so I can do something like SELF:DisableItem(nValue)
>
> How can I achieve this?
>
> Dick
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <public@ic2remove.this.com> |
|---|---|
| Date | 2011-11-22 19:17 +0100 |
| Message-ID | <vnpnc7hcq11hnf6gnjgdgruv6bbtkkcuco@4ax.com> |
| In reply to | #2485 |
On Tue, 22 Nov 2011 16:48:22 +0100, Camille Kater <katercamXXX@pt.lu>
wrote:
Hello Camille,
>
>Maybe this function from Ivo Wessel can help:
>
>Function MenuGetID (oMenu, symEventName) As DWord
>// Ermittelt aus dem symbolischen EventName einer Option die numerische ID
>Local nPos, nID As DWord
>
>nPos := AScan (oMenu:Items, { | a | a [2]:nameSym == symEventName })
>
>IF nPos > 0
>nID := oMenu:Items [nPos,1]
>ENDIF
>
>Return nID
With addition of this access:
ACCESS Items CLASS Menu
RETURN SELF:aItem
and a little rewriting (pass the symbolic methods from the menu
instead of the ID-string), this is exactly what I was looking for!
Thanks,
Dick
[toc] | [prev] | [next] | [standalone]
| From | "Marc Verkade [Marti]" <marcatm@rti.nl> |
|---|---|
| Date | 2011-11-26 11:06 +0100 |
| Message-ID | <4ed0ba7d$0$772$58c7af7e@news.kabelfoon.nl> |
| In reply to | #2489 |
This is what my MC_Menu classes do.
http://cavo.marti.nl/
Grtz, Marc
"D.J.W. van Kooten" schreef in bericht
news:vnpnc7hcq11hnf6gnjgdgruv6bbtkkcuco@4ax.com...
On Tue, 22 Nov 2011 16:48:22 +0100, Camille Kater <katercamXXX@pt.lu>
wrote:
Hello Camille,
>
>Maybe this function from Ivo Wessel can help:
>
>Function MenuGetID (oMenu, symEventName) As DWord
>// Ermittelt aus dem symbolischen EventName einer Option die numerische ID
>Local nPos, nID As DWord
>
>nPos := AScan (oMenu:Items, { | a | a [2]:nameSym == symEventName })
>
>IF nPos > 0
>nID := oMenu:Items [nPos,1]
>ENDIF
>
>Return nID
With addition of this access:
ACCESS Items CLASS Menu
RETURN SELF:aItem
and a little rewriting (pass the symbolic methods from the menu
instead of the ID-string), this is exactly what I was looking for!
Thanks,
Dick
[toc] | [prev] | [next] | [standalone]
| From | "richard.townsendrose" <richard.townsendrose@gmail.com> |
|---|---|
| Date | 2011-11-26 03:12 -0800 |
| Message-ID | <0592349f-a296-4b82-9a70-694fa9d39491@s7g2000yqa.googlegroups.com> |
| In reply to | #2511 |
Dick
whenever you change a menu it re writes all the defines ...
but the IDM_My_menu_My_Item stays the same
Richard
see here ... i have added a list of documents types to my menu ...
METHOD FixMenu() CLASS MailBr
// NOT for RFI's and NOT for Own mail
LOCAL mMenu AS Menu
LOCAL n AS WORD
SELF:aFilterWhat:={NULL_STRING, NULL_STRING, NULL_STRING,
NULL_STRING, NULL_STRING, NULL_STRING, NULL_STRING}
SELF:aForms:=SysObject():GetCat(FORM_TYPE):ListBoxArray
SELF:aWhatTicked:=ArrayNew(11 + ALen(SELF:aForms)-1) // rgtr
221111
FOR n:=1 TO 11 + ALen(SELF:aForms)-1 // rgtr
221111
SELF:aWhatTicked[n]:=FALSE
NEXT
mMenu:=SELF:oDCMailbBr:ContextMenu
FOR n:=2 TO Len(SELF:aForms) // array
starts at "please select"
mMenu:InsertItem(1000 + n-1, HyperLabel{#DoesNothing, SELF:aForms[n,
1]},IDM_MailBrowseMenu__Dmy_Kill_ID)
NEXT
mMenu:DeleteItem(IDM_MailBrowseMenu__Dmy_Kill_ID)
SELF:oDCMailbBr:ContextMenu:=mMenu
mMenu:CheckItem(IDM_MailBrowseMenu__Dmy_All_Documents_ID)
RETURN NIL
and then i access it all using menucommand ... see the first line ....
METHOD MenuCommand(oMenuCommandEvent) CLASS MailBr
LOCAL dwAtRec AS DWORD
DO CASE
CASE oMenuCommandEvent:ItemId > 1000 .AND. oMenuCommandEvent:ItemId
< 1037
SELF:SelSet(#Form, oMenuCommandEvent:ItemId)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_Select_Job_No_ID
SELF:SelSet(#JobNo)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_Select_Sender_ID
SELF:SelSet(#Person, 1)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_Select_Recipient_ID
SELF:SelSet(#Person, 2)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_Select_Chain_ID // NOT own mail and NOT
rfi
IF ! SELF:aWhatTicked[TickedChain] // setting
chain ...
dwAtRec:=SELF:oDCMailbBr:Server:RecNo
SELF:SelSet(#All)
SELF:SelSet(#JobNo)
SELF:oDCMailbBr:Server:GoTo(dwAtRec)
ENDIF
SELF:SelSet(#DocChain)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_Own_Documents_ID
SELF:SelSet(#DocType, 1)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_Others_Documents_ID
SELF:SelSet(#DocType, 2)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_Select_Group_ID
SELF:SelSet(#Group)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_Select_Subject_ID
SELF:SelSet(#Subject)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_Last_7_days_ID
SELF:SelSet(#Days, 7)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_Last_30_days_ID
SELF:SelSet(#Days, 30)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_Last_90_days_ID
SELF:SelSet(#Days, 90)
CASE oMenuCommandEvent:ItemId == 2001 // own and rfi only
SELF:SelSet(#Open)
CASE oMenuCommandEvent:ItemId == 2002
SELF:SelSet(#Closed)
CASE oMenuCommandEvent:ItemId == 3001 // own mail only
SELF:SelSet(#Action, 1)
CASE oMenuCommandEvent:ItemId == 3002
SELF:SelSet(#Action, 2)
CASE oMenuCommandEvent:ItemId ==
IDM_MailBrowseMenu__Dmy_All_Documents_ID
SELF:SelSet(#All)
OTHERWISE
SUPER:MenuCommand(oMenuCommandEvent)
ENDCASE
RETURN NIL
[toc] | [prev] | [next] | [standalone]
| From | E®!k \\/!$$E® <nospam@nospam.url> |
|---|---|
| Date | 2011-11-26 13:40 +0100 |
| Message-ID | <9jc51hFpkvU1@mid.individual.net> |
| In reply to | #2489 |
There is a disadvantage to this approach. If you change the caption of the
menuitem, the name of the constant (and the corresponding symbol ) changes.
Erik
"D.J.W. van Kooten" schreef in bericht
news:vnpnc7hcq11hnf6gnjgdgruv6bbtkkcuco@4ax.com...
On Tue, 22 Nov 2011 16:48:22 +0100, Camille Kater <katercamXXX@pt.lu>
wrote:
Hello Camille,
>
>Maybe this function from Ivo Wessel can help:
>
>Function MenuGetID (oMenu, symEventName) As DWord
>// Ermittelt aus dem symbolischen EventName einer Option die numerische ID
>Local nPos, nID As DWord
>
>nPos := AScan (oMenu:Items, { | a | a [2]:nameSym == symEventName })
>
>IF nPos > 0
>nID := oMenu:Items [nPos,1]
>ENDIF
>
>Return nID
With addition of this access:
ACCESS Items CLASS Menu
RETURN SELF:aItem
and a little rewriting (pass the symbolic methods from the menu
instead of the ID-string), this is exactly what I was looking for!
Thanks,
Dick
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web