Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 6 Jahren, 3 Monaten
Letzter Beitrag:
vor 6 Jahren, 3 Monaten
Beteiligte Autoren:
Clarion Ghost, DarrenF, Piet van Zanten

Displaying a Date on a Form

Startbeitrag von Clarion Ghost am 14.05.2012 18:48

EDT_SaisieDateEx = Today()

I would like to display either today's date or the first day of the month in a 'Calendar' edit box as the form opens.

How would I do this please.

Many Thanks

Antworten:

Hi Ian,

I don't have WB, but in WD I would put it in the Initialis(z)ation event of the form/window.

von DarrenF - am 14.05.2012 19:07
Hi Darren,

Yes, That is what I thought, but I haven't been able to get it to display?

Ian

von Clarion Ghost - am 14.05.2012 19:15
Ian,

I have a very limited knowledge of WB, but knowing what I know about web technology, you'll have to consider the Client and Server elements of what's going on. When your code runs, where is it trying to get the date from?

Can you debug the code to see where the code is running and what it's attempting to do?

von DarrenF - am 14.05.2012 22:02
Hi Darren,

Well, you are not alone in having limited knowledge. Mine is really limited! I have only had WD16 since the end of January and no previous experience of the Client/Server relationship. So 'Newbie' doesn't begin to describe my position in the pecking order. Having said that, I am finding that WD16 is brilliant, and I haven't even scratched the surface yet. Anyway, back to today's problem.

I have this code sitting in the Load (onload) element for Browser Code in a Form.

EDT_SaisieDateEx = today() // This displays in the edit box.

I have a PROCEDURE which brings forward data from a table

PROCEDURE PAGE_LOOPER_Form_Transactions(MyAction,OpeningDate)

MyAction = 1 - (1 = Insert)

As OpeningDate and MyAction cannot be read in the Browser Code area because it is part of the Procedure, I have copied this information to another Global variable thus:-

BrowserOpeningDate is Date
BrowserMyAction is int

BrowserOpeningDate = OpeningDate
BrowserMyAction = MyAction

So far so good.

I have placed

//EDT_SaisieDateEx = today() // This displays
IF BrowserMyAction = 1 THEN EDT_SaisieDateEx = BrowserOpeningDate

in the Load (onload) element for Browser Code and get no result in the edit box.

What am I doing wrong?

Many Thanks

von Clarion Ghost - am 15.05.2012 08:22
Hi Ian,

...and my last question... can you run it in debug?

Sometimes, it's the only way. I've learnt a lot (admittedly about WD), and made some unexpected discoveries while running things in debug [[5]]

von DarrenF - am 15.05.2012 14:14
Hi Ian,

Have you tried putting the code in the initialization code of the page or in the initialization code of the control itself?
That way the initialization is done before the page gets displayed in the browser.
That's probably faster too, because no extra javascript code has to be included in the page. (Browser code generates extra javascript in the page)
BTW: the first date of the month is: left(DateSys(),6)+"01".

Regards,
Piet

von Piet van Zanten - am 15.05.2012 15:14
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.